go away spammer

Author Topic: 10 bit ADC resolution  (Read 4398 times)

0 Members and 1 Guest are viewing this topic.

Offline superchikuTopic starter

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
10 bit ADC resolution
« on: March 18, 2008, 09:12:42 AM »
can anyone tell me how i read all the 10 bits of the adc resolution in an atmega16 and store them in a variable??
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline TrickyNekro

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,208
  • Helpful? 15
  • Hardware and Firmware Designer
    • The Hellinic Robots Portal
Re: 10 bit ADC resolution
« Reply #1 on: March 18, 2008, 10:05:20 AM »
Compiler???
But in general words you just need a variable big enough...
A Word variable is nice here (16 bit variable)

Cheers...

If you are using BASCOM-AVR I can help you...
For whom the interrupts toll...

paulstreats

  • Guest
Re: 10 bit ADC resolution
« Reply #2 on: March 18, 2008, 06:12:19 PM »
I usually work with pics but see if this applies:

There are 2 byte registers containing the 10 bit reading called ADRESH and ADRESL, they can set to either left or right justify.

All I do is to:

Int reading = 0;

//do adc conversion

reading = ADRESL;
reading += (ADRESH*256);

Something like this, so the register that contains the appropriate 9th and 10th bit gets multiplied by 256. The total value is stored in the int variable reading.

Offline superchikuTopic starter

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: 10 bit ADC resolution
« Reply #3 on: March 18, 2008, 11:49:52 PM »
nice answer yes the atmega system is same as pic only names are different and the compiler iam using is winavr
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline benji

  • Supreme Robot
  • *****
  • Posts: 830
  • Helpful? 0
Re: 10 bit ADC resolution
« Reply #4 on: March 19, 2008, 08:59:44 AM »
its pretty much clear in the datasheet, check the ones on the atmel website , they provide examples
good ol' BeNNy

Offline superchikuTopic starter

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: 10 bit ADC resolution
« Reply #5 on: March 19, 2008, 10:50:41 PM »
yes done that thanks...
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

 


Get Your Ad Here

data_list