Author Topic: Problems changing the Axon ADC voltage reference  (Read 1321 times)

0 Members and 1 Guest are viewing this topic.

Offline An3Topic starter

  • Beginner
  • *
  • Posts: 6
  • Helpful? 0
Problems changing the Axon ADC voltage reference
« on: March 18, 2010, 03:55:03 AM »
Hi. I'm using the latest Axon source code (v1.11). I'm using the code example from the Axon function list to change the ADC voltage reference from 5V to the internal 2,56V (http://www.societyofrobots.com/axon/axon_function_list.shtml#adc ). Here's the code:
Code: [Select]

a2dSetReference(ADC_REFERENCE_256V);
delay_ms(1);                          //wait for changes
int value = a2dConvert8bit(5);   //refresh ADC
value = a2dConvert8bit(5);        //read ADC pin 5
rprintf("\n A/D-value: %d ", value);

rprintf writes the same A/D-values as it does when I'm using the AVCC voltage reference. More specific: When the ADC pin read 2V the A/D value will be 102 (2V*(255/5V)  when it use 5V reference (AVCC). When i change the voltage reference to 2.56 the new A/D value for 2V should be 200 (2V*(255/2,56)), but rprintf still writes 102.   Anyone know what I'm doing wrong? ??? Thanx for all replies  :)

 


Get Your Ad Here