Society of Robots - Robot Forum
Software => Software => Topic started by: airman00 on February 08, 2009, 05:45:42 PM
-
I saw this comment on one instructables project
You should be able to set your "ADC" AVR to use the internal 2.56V internal reference which is ideal for reading this sensor.
I am using AVRlib and the ATmega168 running at internal 8mhz clock.
How can I modify the code below to use the internal reference of 2.56V ?
a2dInit(); // initialize analog to digital converter (ADC)
a2dSetPrescaler(ADC_PRESCALE_DIV32); // configure ADC scaling
a2dSetReference(ADC_REFERENCE_AVCC); // configure ADC reference voltage
-
I saw this:
INTERNAL: an built-in reference, equal to 1.1 volts on the ATmega168 and 2.56 volts on the ATmega8.
Nevermind then , the ATmega168 can only do 1.1 volts for internal reference
-
Found this in the Datasheet
ADC Voltage Reference
The reference voltage for the ADC (VREF) indicates the conversion range for the ADC. Single
ended channels that exceed VREF will result in codes close to 0x3FF. VREF can be selected as
either AVCC, internal 1.1V reference, or external AREF pin.
Anyway I can boost up that 1.1V internal reference to 2.56V ?
-
No.
But if you used the normal Vcc (ie 5v) then could you not just sample the 2.56v inputs and then multiply your result by 2?
This would mean that you are effectively lowering the maximum precision from 10bit to 9bit. So IF you are storing it as an 8 bit value then it wont make any difference.