Ad, Da Converters
Ad, Da Converters
3 18
Embedded Systems I/O AD and DA Converters
Version 2 EE IIT, Kharagpur 1 Version 2 EE IIT, Kharagpur 2
Instructional Objectives Signal Processing
After going through this lesson the student would be able to Analog Processing
Analog Processing
x Learn about Real Time Signal Processing Analog Processor
Measurand Sensor Conditioner ADC
x Sampling Theorem LPF
x DA Conversion
x Different Methods of AD Conversions
o Successive Approximation Digital Processing
o Flash
Analog Processor
o Sigma Delta DSP DAC
LPF
Display b bits
Micro- Decoder Sample/hold
[yb(n)] y(n)
controller
Keyboard
Fig. 18.3 The functional layout of the ADC and DAC
3 1
Amplitude
a. Impulse train 0
2
1 -1
Amplitude
0 -2
-1 -3
0 1 2 3 4 5
Time
-2
Fig. 18.4(c) The reconstructed analog signal after filtering
-3 A digital word (8-bits or 16-bits) can be converted to its analog equivalent by weighted
0 1 2 3 4 5 averaging. Fig. 18.5(a) shows the weighted averaging method for a 3-bit converter.
Time A switch connects an input either to a common voltage V or to a common ground. Only
Fig. 18.4(a) The analog equivalent of digital words switches currently connected to the voltage source contribute current to the non-inverting input
summing node. The output voltage is given by the expression drawn below the circuit diagram;
SX = 1 if switch X connects to V, SX = 0 if it connects to ground. There are eight possible
3 combinations of connections for the three switches, and these are indicated in the columns of the
table to the right of the diagram. Each combination is associated with a decimal integer as
c. Zeroth-order hold shown. The inputs are weighted in a 4:2:1 relationship, so that the sequence of values for 4S3 +
2
2S2 + S1 form a binary-coded decimal number representation. The magnitude of Vo varies in
units (steps) of (Rf/4R)V from 0 to 7. This circuit provides a simplified Digital to Analog
1 Converter (DAC). The digital input controls the switches, and the amplifier provides the analog
Amplitude
output.
0
-1
-2
-3
0 1 2 3 4 5
Time
Fig. 18.4(b) The analog voltage after zero-order hold
V0 = -R f S3 V + S2 V + S1 V
R 2R 4R 6 1 1 0
Capacitor
-R 7 1 1 1
= f V(4S3 + 2S2 + S1)
4R
Control signal
Fig. 18.5(a) The binary weighted register method
1
V Rf 0.8
S3
2R 2R 0.6
- 0.4
S2 + V0
2R R 0.2
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9
V 1
S1
2R R 1(S3) = 3R 2 S3 Fig. 18.6 The Sample and Hold Circuit
1(S2) = V 1 S2
3R 4
2R
1(S1) = V 1 S1
3R 8
V0 = -R f S3 V 1 + S2 V 1 + S1 V 1
3R 2 3R 4 3R 8
= - Rf V (4S3 + 2S2 + S1)
24R
Fig. 18.5(b) R-2R ladder D-A conversion circuit
Fig. 18.5(b) depicts the R-2R ladder network. The disadvantage of the binary weighted register is
the availability and manufacturing of exact values of the resistances. Here also the output is
proportional to the binary-coded decimal number.
The output of the above circuits as given in Fig. 18.5(a) and 18.5(b) is equivalent analog
values as shown in Fig. 18.4(a). However to reconstruct the original signal this is further passed
through a zero order hold (ZOH) circuit followed by a filter (Fig.18.2). The reconstructed
waveforms are shown in Fig. 18.4(b) and 18.4(c).
Version 2 EE IIT, Kharagpur 7 Version 2 EE IIT, Kharagpur 8
Analog Signal
2 3025
1.5 c. Digitized signal
Amplitude
1 3020
Digital number
0.5
3015
0
-0.5
0 0.5 1 1.5 2 2.5 3 3.5 4 3010
time(ms)
Sampled Signal after the capacitor
2
3005
1.5
Amplitude
1 3000
0.5 0 5 10 15 20 25 30 35 40 45 50
0 Sample number
3.015 The definition of proper sampling is quite simple. Suppose you sample a continuous signal in
some manner. If you can exactly reconstruct the analog signal from the samples, you must have
done the sampling properly. Even if the sampled data appears confusing or incomplete, the key
3.010
information has been captured if you can reverse the process. Fig.18.9 shows several sinusoids
before and after digitization. The continuous line represents the analog signal entering the ADC,
3.005 while the square markers are the digital signal leaving the ADC. In (a), the analog signal is a
constant DC value, a cosine wave of zero frequency. Since the analog signal is a series of
straight lines between each of the samples, all of the information needed to reconstruct the
3.000 analog signal is contained in the digital data. According to our definition, this is proper sampling.
0 5 10 15 20 25 30 35 40 45 50
Time The sine wave shown in (b) has a frequency of 0.09 of the sampling rate. This might represent,
for example, a 90cycle/second sine wave being sampled at1000 samples/second. Expressed in
Fig. 18.8(a) Hold Circuit Output
Version 2 EE IIT, Kharagpur 9 Version 2 EE IIT, Kharagpur 10
another way, there are 11.1 samples taken over each complete cycle of the sinusoid. This 3 3
situation is more complicated than the previous case, because the analog signal cannot be a. Analog frequency = 0.0 (i.e., DC) b. Analog frequency = 0.09 of sampling rate
reconstructed by simply drawing straight lines between the data points. Do these samples 2 2
properly represent the analog signal? The answer is yes, because no other sinusoid, or 1 1
Amplitude
Amplitude
combination of sinusoids, will produce this pattern of samples (within the reasonable constraints
listed below). These samples correspond to only one analog signal, and therefore the analog 0 0
signal can be exactly reconstructed. Again, an instance of proper sampling. In (c), the situation is
-1 -1
made more difficult by increasing the sine wave's frequency to 0.31 of the sampling rate. This
results in only 3.2 samples per sine wave cycle. Here the samples are so sparse that they don't -2 -2
even appear to follow the general trend of the analog signal. Do these samples properly represent
-3 -3
the analog waveform? Again, the answer is yes, and for exactly the same reason. The samples Time (or sample number) Time (or sample number)
are a unique representation of the analog signal. All of the information needed to reconstruct the
continuous waveform is contained in the digital data. Obviously, it must be more sophisticated
than just drawing straight lines between the data points. As strange as it seems, this is proper 3 3
c. Analog frequency = 0.31 of sampling rate d. Analog frequency = 0.95 of sampling rate
sampling according to our definition. In (d), the analog frequency is pushed even higher to 0.95 2 2
of the sampling rate, with a mere 1.05 samples per sine wave cycle. Do these samples properly
represent the data? No, they don't! The samples represent a different sine wave from the one 1 1
Amplitude
Amplitude
contained in the analog signal. In particular, the original sine wave of 0.95 frequency 0 0
misrepresents itself as a sine wave of 0.05 frequency in the digital signal. This phenomenon of
sinusoids changing frequency during sampling is called aliasing. Just as a criminal might take on -1 -1
an assumed name or identity (an alias), the sinusoid assumes another frequency that is not its
-2 -2
own. Since the digital data is no longer uniquely related to a particular analog signal, an
unambiguous reconstruction is impossible. There is nothing in the sampled data to suggest that -3 -3
the original analog signal had a frequency of 0.95 rather than 0.05. The sine wave has hidden its Time (or sample number) Time (or sample number)
true identity completely; the perfect crime has been committed! According to our definition, this Fig. 18.9 Sampling a sine wave at different frequencies
is an example of improper sampling. This line of reasoning leads to a milestone in DSP, the
sampling theorem. Frequently this is called the Shannon sampling theorem, or the Nyquist
Sampling theorem, after the authors of 1940s papers on the topic. The sampling theorem Methods of AD Conversion
indicates that a continuous signal can be properly sampled, only if it does not contain frequency
components above one-half of the sampling rate. For instance, a sampling rate of 2,000 The analog voltage samples are converted to digital equivalent at the quantizer. There are various
samples/second requires the analog signal to be composed of frequencies below 1000 ways to convert the analog values to the nearest finite length digital word. Some of these
cycles/second. If frequencies above this limit are present in the signal, they will be aliased to methods are explained below.
frequencies between 0 and 1000 cycles/second, combining with whatever information that was
legitimately there.
0 V1 V2 V- 110 010
R3 4
2 - V- 1 V
0 V2 OG1 111 101 011 001
V4 OG2 6 DAC
V+
R4 V+
3 + 7 5 000
Over-sampling
First, consider the frequency-domain transfer function of a traditional multi-bit ADC with a sine-
wave input signal. This input is sampled at a frequency Fs. According to Nyquist theory, Fs must
be at least twice the bandwidth of the input signal. When observing the result of an FFT analysis
on the digital output, we see a single tone and lots of random noise extending from DC to Fs/2
(Fig.18.13). Known as quantization noise, this effect results from the following consideration:
the ADC input is a continuous signal with an infinite number of possible states, but the digital
output is a discrete function, whose number of different states is determined by the converter's
(1-bit ADC)
Fig. 18.14 FFT diagram of a multi-bit ADC with a sampling frequency kFS and effect of
Digital Filter on Noise Bandwidth
Noise Shaping
It includes a difference amplifier, an integrator, and a comparator with feedback loop that
contains a 1-bit DAC. (This DAC is simply a switch that connects the negative input of the
difference amplifier to a positive or a negative reference voltage.) The purpose of the feedback
DAC is to maintain the average output of the integrator near the comparator's reference level.
The density of "ones" at the modulator output is proportional to the input signal. For an
increasing input the comparator generates a greater number of "ones," and vice versa for a
decreasing input. By summing the error voltage, the integrator acts as a lowpass filter to the input
signal and a highpass filter to the quantization noise. Thus, most of the quantization noise is
pushed into higher frequencies. Oversampling has changed not the total noise power, but its
distribution. If we apply a digital filter to the noise-shaped delta-sigma modulator, it removes
more noise than does simple oversampling.(Fig.18.16).
Fig. 18.16 The Effect of Integrator and Digital Filter on the Spectrum
The output of the sigma-delta modulator is a 1-bit data stream at the sampling rate, which can be Q3. What are the various specifications of an A-D converter?
in the megahertz range. The purpose of the digital-and-decimation filter (Fig.18.17) is to extract
information from this data stream and reduce the data rate to a more useful value. In a sigma- Ans: No. of bits (8-bits, 16-bits etc), No. of channels, Conversion Time, Power Supply
delta ADC, the digital filter averages the 1-bit data stream, improves the ADC resolution, and range, Power Consumption, Various Temperature ratings, Packaging
removes quantization noise that is outside the band of interest. It determines the signal
bandwidth, settling time, and stop band rejection. Q4. How to construct a second order Delta-Sigma AD Converter.
In this chapter you have learnt about the basics of Real Time Signal Processing, DA and AD Q5. What method you will adopt to digitize a slowly varying temperature signal without using
conversion methods. Some microcontrollers are already equipped with DA and AD converters AD converter?
on the same chip. Generally the real world signals are broad band. For instance a triangular wave
though periodic will have frequencies ranging till infinite. Therefore anti-aliasing filter is always Ans: Instead of AD Converters use Voltage to Frequency Converters followed by a counter
desirable before AD conversion. This limits the signal bandwidth and hence finite sampling
frequency. The question answer session shall discuss about the quantization error, specifications
of the AD and DA converters and errors at the various stages of real time signal processing. The
details of interfacing shall be discussed in the next lesson.
The AD and DA converter fall under mixed VLSI circuits. The digital and analog circuits
coexist on the same chip. This poses design difficulties for VLSI engineers for embedding fast
and high resolution AD converters along with the processors. Sigma-Delta ADCs are most
complex and hence rarely found embedded on microcontrollers.