Analog-To-Digital (A/D) and Digital-To-Analog (D/A) Conversion
Analog-To-Digital (A/D) and Digital-To-Analog (D/A) Conversion
DIGITAL-TO-ANALOG (D/A)
CONVERSION
1.1 Introduction
1
2
1.2.1 Introduction
Since the output of the DAC is proportional to the binary input, we can write that
bn × 2n + bn−1 × 2n−1 + . . . + b1 × 21 + b0 × 20 .
Output of DAC ∝ (1.2)
From equation (1.2), it can be seen that the contributions of each digital input are
weighted according to their position in the binary number. The output voltage can
thus be considered to be the weighted sum of the digital inputs. The weights are suc-
cessively doubled for each bit, beginning with the Least Significant Bit. This weight-
ing factors are the basis on which Digital-to-Analog Converters (DACs) are made.
The weighted resistor converter assigns weights to digital inputs by using appropri-
ately weighted resistors. The resistors are weighted so that the resistors are inversely
proportional to the numerical significance of the corresponding numerical digit. The
operation of the converter depends on the successive resistances being related by a
factor of 2 and does not depend on the absolute values of the resistors. An opera-
tional amplifier is employed as a summing amplifier which produces a weighted sum
of the input voltages. An example of a 4-bit weighted resistor converter is shown on
Figure 1.1.
DCBA is a four-bit digital word. Assuming a HIGH level voltage =VREF and LOW
level voltage = 0, then we can write:
(1.3)
A B C D A B C
VOU T = −VREF + + + R = −VREF + + +D
8R 4R 2R R 8 4 2
3
R
MSB D
2R R
C
4R
B −
For VREF = 5V , the outputs from the above equation can be tabulated as below:
D C B A VOUT
0 0 0 0 0
0 0 0 1 -0.625
0 0 1 0 -1.250
0 0 1 1 -1.875
0 1 0 0 -2.500
0 1 0 1 -3.125
0 1 1 0 -3.750
0 1 1 1 -4.375
1 0 0 0 -5.000
1 0 0 1 -5.625
1 0 1 0 -6.250
1 0 1 1 -6.875
1 1 0 0 -7.500
1 1 0 1 -8.125
1 1 1 0 -8.750
1 1 1 1 -1.375
The Resolution of a DAC is defined as the smallest change that can occur in the analog
output as a result of a change in the digital input. From the table above, we can see
that the resolution of the DAC is 0.625V, while the full scale analog output voltage is
-1.375V.
Exercise
The resolution of an 8-bit DAC is 0.2V.
i) What is the output voltage when the input code is 01100100?
ii) What is the maximum analog output voltage?
(20V, 51V)
The value of the feedback resistor in Figure 1.1 can be used to change the range of
the output voltage and the resolution e.g. suppose the feedback resistor was changed
from R to 0.5R then
(1.4)
A B C D R A B C D
VOU T = −VREF + + + = −VREF + + +
8R 4R 2R R 2 16 8 4 2
In this case, the resolution is 0.3125V, and the maximum analog output is -4.6875.
The main disadvantage of this method is the wide spread of resistance values for a
large number of bits, e.g. suppose we used a 2KΩ resistor for the MSB, then for a
14-bit DAC, the resistor for the LSB will be 2KΩ × 213 = 16.4M Ω. Resistors covering
such a wide range which have the required precision and which track over a wide
4
The weighted resistor DAC can be modified to accommodate a large number of bits
without consequent spread in resistor values. An 8-bit modified weighted resistor
DAC is shown on Figure 1.2.
PSfrag replacements
R
MSB b7
2R
b6
4R R
b5
8R
b4 −
R
b3 + VOU T
2R
b2 r
4R
b1
8R
LSB b0
VREF b2 2R R
b1 4R r
−
b0 8R
+ VOU T
Resistors 2R, 4R and 8R are in parallel so we can redraw Figure 1.3 as shown on
Figure 1.4.
Again noting that resistors 8R
7
and r are in parallel, we can write the expression for
the current I as:
VREF 8R
VREF 7
+r
I= = 15rR 8R2 (1.5)
R + r// 8R
7 7
+ 7
5
R
PSfrag replacements
I R IIN r
−
+ VOU T
VREF 8R
___
7
8R
+ r 8R
IIN = VREF 7 VREF 8R
8R2
8R 7 = (1.6)
15rR
7
+ 7 7
+r 15rR + 8R2
1
The current due to b7 is VREF /R and the current IIN due to b3 must be 16
of this
current due to b7 . We can therefore write
VREF 8R VREF
2
= (1.7)
15rR + 8R 16R
which simplifies to:
r = 8R (1.8)
Exercise
Given the circuit shown on Figure 1.2, assuming that the code b7 b6 b5 b4 b3 b2 b1 b0 is in
BCD code, show that r = 4.8R.
The R-2R ladder network uses resistors of only two sizes, R and 2R. This array re-
quires twice as many resistors for the same number of input bits as the weighted
resistor array. Bits are weighted by providing paths for current division with conse-
quent successive attenuations for bits of lower significance. The op-amp is used to
sum the current contributions of each bit. An example of a 4-bit R-2R ladder net-
work is shown in Figure 1.5. The switches shown in the figure can be connected
to ground (0) or to VREF (1). In the example shown in Figure 1.5, the input code
DCBA = 0001.
The network works on the principle of the current splitting exactly in half at each
node. As such, it is the R-2R ratio of the resistors that is important and not the ab-
solute value of the resistors. The current contribution from each bit is then passed
through the op-amp to develop an output voltage VOU T . The op-amp therefore con-
verts binary-scaled currents to an output voltage.
6
R R R 2R RF
−
2R 2R 2R 2R 2R +
VOU T
D
A B C
LSB MSB
Making RF adjustable allows the output voltage to be set to any desired range within
the saturation limits of the operational amplifier.
The circuit shown on Figure 1.5 has an input digital code DCBA = 0001. The
equivalent circuit is shown in Figure 1.6.
2R 2R 2R 2R 2R 2R
VREF
0.5I 0.5I
2R 2R 2R
VREF
DIGITAL
INPUTS
ANALOG
OUTPUT
Resolution The smallest change that can occur in the analog output as a result of a
change in the digital input. Resolution gets finer with an increase in the number
of bits e.g. a 10-bit DAC has a finer resolution than a 4-bit DAC for the same
output range. An ideal DAC should have an infinitely small resolution.
Accuracy The accuracy of a DAC is the difference between the actual output voltage
and the expected output voltage. It is usually specified as a percentage of the
full-scale output voltage.
Settling time This is used to specify the conversion speed of a DAC. It is the time
required for the output to go from zero to full-scale as the binary inputs are
varied from all zeros to all ones.
Temperature Sensitivity At any fixed digital input, the analog voltage will vary
with temperature. Temperature sensitivity specifies by how much the output
changes per unit change in temperature.
Offset Voltage Ideally, the output of a DAC should be zero volts when the binary
input is all zeros. In practice, there will be a small output voltage caused by
the offset error in the output op-amp. Most DACs have an offset adjustment
capability that allows the user to zero the offset error.
Examples of DAC ICs are 12-bit AD767, 8-bit AD557JN (these two ICs are microprocessor-
compatible), 8-bit ZN425E, 8-bit ZN435E, 8-bit ZN428E etc. More information about
these DACs can be obtained from the data books.
An analog to digital converter takes an analog input voltage and produces a digital
output code which represents the analog input. There are many methods of analog
to digital conversion and in this course, we shall look at the most common methods.
For the comparator shown in the figure, if VA > VB , EOC = HIGH, and VA < VB ,
EOC = LOW.)
Operation of the Digital Ramp ADC
A START pulse is applied and this resets the counter to zero.
Setting the START pulse to HIGH, inhibits the AND gate so that no clock pulses get
through to the counter. This sets the counter to zero, VB = 0 so the comparator
output is HIGH.
When the START pulse returns LOW, the AND gate is enabled and pulses allowed into
the counter. The DAC’s output VB increases in steps of voltage equal to its resolution.
When V B reaches VA , the comparator output goes LOW, inhibiting pulses to the
counter so that the counter stops and holds the desired digital
9
CLOCK INPUT
ANALOG INPUT VA
VOLTAGE + EOC
VB −
COMPARATOR
DIGITAL
COUNTER
TO
ANALOG
RESET
CONVERTER
START PULSE
code representing VA . The HIGH to LOW transition at the comparator output signals
the End Of Conversion (EOC). This is illustrated by Figure 1.10. The conversion time
is the interval between t0 and t1 .
1
START
0
VA
VB
0V
1
EOC
0
t0 t1
Note that the conversion time for this converter is not constant: the higher the analog
input, the higher the conversion time.
Exercise
A ramp ADC has a clock running at a frequency of 1MHz. The input voltage ranges
from 0 to 40.95V for a 12-bit output. Determine:
i) The resolution of the ADC
ii) The digital equivalent of 7.828V
iii) The conversion time for VA = 7.828V
iv) The maximum conversion time for this converter.
(10mV, 001100001111, 783 µsec, 4095 µsec)
10
This method is essentially a binary search. It works by trying various binary codes
and feeding them into a DAC and comparing the result with the analog input via a
comparator. This converter is illustrated in Figure 1.11. (For the comparator shown
in the figure, if VA > VB , COMP = HIGH, and if VA < VB , COMP = LOW.)
ANALOG
INPUT
VA +
COMP CLOCK INPUT
VB −
COMPARATOR CONTROL START
LOGIC END OF
CONVERSION
REGISTER
MSB LSB
DAC
i) The control logic sets the MSB of the register HIGH and all the other bits LOW.
This produces a value of VB at the DAC output that is equal to the weight of
the MSB. If VB is now greater than VA , the comparator output goes LOW and
causes the control logic to clear the MSB back to LOW. Otherwise the MSB is
kept HIGH.
ii) The control logic sets the next bit of the register to 1. This produces a new
value of VB . If the value of VB is greater than VA , the comparator output goes
LOW to tell the control logic to clear the bit back to 0. Otherwise the bit is kept
at 1.
iii) The process is repeated for each of the bits in the register. After all the bits have
been tried, the register holds the digital equivalent of VA .
Testing each bit takes one clock cycle so for an N -bit converter, conversion will take
N clock cycles regardless of the value of the analog input voltage.(In other words for
a given number of bits, the conversion time is constant).
As an example to illustrate this procedure, consider a 6-bit successive approximation
converter with a resolution of 1V (it can therefore convert voltages in the range
0-63V). If an input voltage of 37.4V is applied as VA , the output can be determined
using the table below:
11
The digital equivalent of 37.4V is the final value in the register, which is 100101. The
profile of the voltage VB during the conversion is shown in Figure 1.12.
VB
CODE
111111 (=63V)
110000
101000
100110
VA
100101
100100
100000
100000 (=32V)
000000 (=0V)
1st Iteration 2nd Iteration 3rd Iteration 4th Iteration 5th Iteration 6th Iteration time
The block diagram of the dual-slope integration converter is shown in Figure 1.13.
The conversion begins with the electronic switch in the T1 position, with the counter
reset to zero and the capacitor fully discharged. The input voltage causes the capaci-
tor connected to the op-amp to charge at a rate dependent on the magnitude of the
input voltage. For the integrator, we can write that
Z t
1
VOU T = − vin dt + initial capacitor voltage (1.12)
RC 0
The capacitor has no initial charge and the input voltage vin is a constant voltage
VIN . Substituting these values and integrating gives
VIN t
VOU T = − (1.13)
RC
Equation (1.13) is the equation of a straight line starting at the origin and with a
gradient of − VRC
IN
.
12
SWITCH
V IN
ANALOG
R C
INPUT T1 VOUT
T2
−VREF −
+ −
INTEGRATOR +
COMPARATOR
CONTROL
CLOCK LOGIC
COUNTER
DIGITAL OUTPUT
After T1 seconds have elapsed, the switch is moved to T2 by the control logic. The
higher the input voltage VIN , the greater the charge stored in the capacitor during
T1 . Because the reference voltage is of the opposite polarity to the analog input,
the capacitor now discharges. The control logic also starts the counter the moment
the switch is moved to T2 . When the capacitor has fully discharged, the comparator
output level switches and the counter is halted. The value in the counter is directly
proportional to the input voltage VIN .
Consider the integrator equation (1.12). During the discharge phase, the input volt-
age vin equals a constant voltage −VREF , while the initial capacitor voltage is − VIN
RC
T1
.
Substituting these values in equation (1.12) gives
Z t
VOU T = − 1 V IN T 1
(−VREF ) dt + − . (1.16)
RC 0 RC
Integrating,
VREF t VIN T1
VOU T = − (1.17)
RC RC
VREF
This is an equation of a straight line with a gradient RC
.
(Note that the charging graph and discharging graphs have different slopes, hence the
name dual-slope converter).
13
When the capacitor has fully discharged, VOU T = 0. Substituting this in equation
(1.17) gives
VIN T1
t = T2 = . (1.18)
VREF
Hence
discharge time ∝ input voltage VIN (1.19)
i.e. larger input voltages VIN will require more time to discharge.
The charging and discharging graphs are shown on Figure 1.14.
FIXED PROPORTIONAL TO
INPUT VOLTAGE
T1 T2
t
0
CHARGING
DISCHARGING
VIN T1
____
RC
VOUT
For the dual-slope ADC, a comparison of 3 analog input voltages V1 , V2 and V3 where
V1 < V2 < V3 is shown in Figure 1.15.
T1
t
0
V1
V2
V3
VOUT
Figure 1.15: Dual-Slope ADC with analog inputs V1 , V2 and V3 where V1 < V2 < V3
Dual-slope converters are very accurate , but they are slow as they are essentially
counting converters. They are commonly used in digital multimeters, and panel
meters where conversion speed is not very important. Advantages of dual slope
ADCs compared to other ADCs are simplicity, low cost and relative immunity to noise
due to the long conversion time.
14
These are the fastest ADCs, where the conversion time equals the sum of the com-
parator plus encoder propagation delays. A typical flash converter has a conversion
time of about 50ns, compared with a typical 20µsec for successive approximation
ADCs. A 3-bit flash ADC is illustrated in Figure 1.16. (For the comparators shown in
the figure, if V+ > V− , output = HIGH, if V+ < V− , output = LOW.)
10V
3K − C7
+ I7
1K C6
− I6
+
1K C
− C5 MSB
+
I5
PRIORITY B DIGITAL
1K − C4
4
+ OUTPUTS
1K I
− C3 ENCODER A
3 LSB
+
1K I
− C2
2
+
1K I
− C1 1
+
1K I0
VIN
ANALOG
INPUT
The operation of this converter can be summarized in the table shown below:
VIN C! C2 C3 C4 C5 C6 C7 C B A
< 1V 1 1 1 1 1 1 1 0 0 0
≥ 1V , < 2V 0 1 1 1 1 1 1 0 0 1
≥ 2V , < 3V 0 0 1 1 1 1 1 0 1 0
≥ 3V , < 4V 0 0 0 1 1 1 1 0 1 1
≥ 4V , < 5V 0 0 0 0 1 1 1 1 0 0
≥ 5V , < 6V 0 0 0 0 0 1 1 1 0 1
≥ 6V , < 7V 0 0 0 0 0 0 1 1 1 0
≥ 7V 0 0 0 0 0 0 0 1 1 1
The main disadvantage of this converter is the large number of comparators required.
An N -bit converter requires (2N − 1) comparators and this increases the circuit com-
plexity and cost when N is large. The use of flash ADCs is restricted to applications
where speed is the prime requirement.
15
• Analog input range – maximum allowable input voltage range e.g. 0 − 10V ,
±5V etc.
• Conversion time.
• Format of the output digital code - 2s complement, unsigned binary, BCD etc.
Examples of ADC ICs are: 12-bit successive approximation AD7870, 8-bit ‘flash’
ADC-304 (TTL compatible outputs), 8-bit ‘flash’ MC10319P (has tri-state outputs),
8-bit ZN439, 8-bit successive approximation ZN427E (microprocessor compatible)
etc. More information about these ICs can be obtained from data books.