avr-chat
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-chat] ATmega16 Differential ADC Measurements


From: Thomas D. Dean
Subject: [avr-chat] ATmega16 Differential ADC Measurements
Date: Fri, 7 Sep 2007 11:26:17 -0700 (PDT)

I have been looking at the ATmega16 adc in the differential mode in
the STK500v2.  I measured the input to the two adc channels with a
Fluke 27 connected directly to the pins.  I saw larger differences
than I expected.  I also expected the values of 0x3ff and 0x000 to be
the same.  Results below.

The book says the value returned is the 2's complement.  The book
gives a conversion:

   ADC = volts*GAIN*512/aref

ADMUX = _BV(MUX4), adc0 - adc1, gain of 1 and aref is 4.96 volts
measured on pin 32 of the DIP package.
volts.

   volts = ADC*4.96/512.

Values of ADC from 0x000 thru 0x1ff are increasing positive.  Values
of ADC from 0x200 thru 0x3ff are decreasing negative.  0x3ff and 0x000
both represent zero.

        if (adc > 0x1ff) {
          conv = adc - 0x3ff;
        } else {
          conv = adc;
        }
        calc_volts = conv*AREF/512

Is that correct?  

Fit to data gives aref = 4.788.  Here are my measured results, based
on aref=4.96.

     Calc.  Meas.  Abs.
ADC  Volts  Volts  Diff.
2f6 -2.567 -2.473  0.094
329 -2.073 -2.001  0.072
35e -1.560 -1.502  0.058
393 -1.046 -0.999  0.047
3c8 -0.533 -0.506  0.027
3ff  0.000  0.000  0.000
000  0.000  0.009  0.009
035  0.513  0.505  0.008
06a  1.027  1.002  0.025
0a1  1.560  1.510  0.050
0d6  2.073  2.005  0.068
106  2.538  2.451  0.087

tomdean




reply via email to

[Prev in Thread] Current Thread [Next in Thread]