Getting Started

(lily) #1

Chapter 9 – Digital Meets Analog – ADC and DAC


f a successive approximation. This method
igital to analog converter. An analog
compar
AC (Digital to Analog Converter
proportional to that number
we’ll
The
output 1024 steps from 0 and its


that the DAC can produce is
volts. We have 10-bits to play with so we can keep approximating in 0.00293
ltage to 1.234 volts. We use a binary
earch technique that starts in the middle and bisects each successive voltage. We

256 to reset it to 0.75
volt and get a 0 meaning that the DAC voltage is now lower than the input
-0.75 volts by sending 384 to the DAC output


. We keep successively approximating until we
etween1.233 and 1.236 volts. This is the best we can do


the ATMEGA169

uccessive approximation Analog to Digital
to an 8-channel analog multiplexer allowing connection to
inputs on PortF. During conversion the voltage is held
and hold circuit. Look in the data book on page 195, figure

the voltage on
t significant bit). We can use an external

Figure 27 shows a simplified diagram o
uses an analog comparator and a d
ator, in this case, is a device that has two analog inputs one for the external
voltage and the other for the voltage from the D
that can accept a digital number and output a voltage



  • examine these later). If the voltage on the DAC is lower than the external
    voltage, the analog comparator outputs a 0, if it is higher it outputs a 1.
    ATmega169 DAC is 10-bits, meaning that it can
    maximum voltage.


Let’s look at the case where the maximum voltage
3 .0
(3.0/1024) volt steps. Let’s set the input vo
s
start by bisecting the 3 volts by sending the number 512 to the DAC, which then
outputs 1.5 volts; the comparator will output a 1, meaning that the DAC voltage is
too high. So we bisect the 1.5 volts by sending the DAC


voltage. Next we bisect the 1.5
1 .215 volts and get a 0, too low
find that the voltage is b
with 0.003 volt steps.


Analog to Digital Conversion with


The ATmega169 has a 10-bit s
Converter connected
one of eight voltage
constant by a sample
82 for a block diagram of the ADC circuit.


The minimum value is GND and the maximum is determined by
the AREF pin (minus 1-bit in the leas
voltage reference attached to this pin, or we can tell the AVR to connect it to
either AVCC or to an internal 1.1 volt reference. This setup allows us to improve
noise immunity by connecting a decoupling capacitor to the AREF to help

Free download pdf