Sei sulla pagina 1di 8

UNIVERSITY of PENNSYLVANIA

DEPARTMENT of ELECTRICAL and SYSTEMS ENGINEERING

Electrical Circuits and Systems II Laboratory


ESE206

Analog to Digital (A-D) and Digital to Analog (D-A)


Conversion
Goals
To become familiar with digitally represented data.
To build a D-A converter and an A-D converter.
To become confident with the construction and trouble-shooting of large circuits.

Introduction

Our perceptual world is largely based on analog inputs. We hear music as a


cascade of sounds which blend into each other. We see color in continuous hues and
shades. We comment on the day being “warm, but not as warm as yesterday.”
Remarkably, physics appears to be mostly an analog system also. Providing we
stay well above the quantum regime, we find that light and sound consists of smooth
waves. When we find an objects length, it could be any value and not limited to integer
values of meters. We note that time doesn’t actually “tick by,” but rather it flows evenly.
For most of its history, electronics were analog. This makes sense, since the goal
of any device is to make our world easier and our world is an analog one. However, at
this point in history, technology is digital. That seems as odd as trying to discuss Russian
literature in Portugese or trying to describe a painting with formulas. It’s just the wrong
language.
But analog circuits have their own troubles. In the first lab we went to great pains
to understand error. We came to understand that we will never own a exactly “1k”
resistor although we can easily own a “1.0k” resistor. And while a power supply might
output 5.00 V it will never output 5V. What’s more, we experienced how difficult it is to
say what a circuit will do when we involve this uncertainty. The root of that difficulty is
because error accumulates.
However, let’s suppose that we could say that an input was either 5.V or 0.V and
that our circuit would output either 5.V or 0.V. While these numbers still contain
uncertainty, it would be possible using error analysis to conclude the result always to be
within 0.5V. What’s more, many such circuits could be applied in series and at the end,
the result would still be certain to 0.5V. If we don’t care about this small deviation, then
in a sense, our circuit contains no “error.”
However there’s a price to pay. This new digital language is very limited. With
one wire we can only say two things (0.V and 5.V), where before in the analog domain
we could say 1.4952V or any other such number if we chose. However, what if our

ESE206 1
digital signal contained two outputs? Then we could say up to four statements through
all the possible permutations of 0.V and 5.V. If we keep going and our circuit has eight
outputs, we find that we now have a vocabulary of 256 words. The average person uses
2000 different words a week which could be accomplished using only 11 such outputs
and an elaborate look-up table. At the end of the day, we find that we just don’t have that
much to say and the price we pay in limiting our vocabulary is worth being able to make
concrete, errorless statements.
A prime example is the comparison between cassette tapes and CD’s. Why was
music piracy not much of an issue in the day’s of cassette tapes? They were actually
easier to copy than CD’s are. The reason was that the data on a cassette was encoded as
an analog signal. Each copy lost some quality and so there was always a market for new
cassettes since the new cassettes were closest to the master recording. However, a CD is
encoded as digital data. It is possible to reproduce them exactly even from copies. While
the CD suffers from the fact that each data value is made from a limited number of bits,
each taking on one of two possible values, the vocabulary of values this outlines is large
enough that your ear can’t tell the difference.
This lab will focus on the translation between the analog and digital domains.
Such circuits are found in almost all devices. There are thousands that are commercially
available. While you will never need to build one in “real world,” doing so will expose
you to several key engineering concepts.

The Relationship between Analog and Digital Data


The relationship between analog and digital data is best illustrated pictorially.
Suppose that we have a 4 bit system, meaning that we have 4 separate digital values by
through which we can specify a number. There are 2 4 = 16 different on/off
combinations that could be made through these values. The range of these values is up to
us. In this lab we will take the lowest possible analog value that -5V while the largest
possible value will be +5V. These will correspond to the bottom of 0000 2 and the top
11112 , respectively. In other words, VFS in Fig. 1 is 5V. FS stands for Full Scale.
Notice that this outlines 16 different voltage bands marked off in red. Each band
corresponds to a different combination of on/off values. These are shown in blue to the
left where blue indicated on while white indicates off. The value of a waveform can
therefore be indicated with these digital outputs. As the analog voltage varies, these
VFS

D0 D1 D2 D3

VFS
D0
D1
D2
D3

Figure 1: Pictorial representation of Analog-to-digital conversion. The bars on the left in blue give the
digital equivalent of the analog wavevorm (4-bit).

ESE206 2
VFS

VFS

VFS

VFS

VFS

VFS

VFS

VFS

Figure 2: Determination of consecutive bits. The top graph shows how the most significant bit it
determined; the 2nd graph shows the remainder generated by the first bit centered and rescaled to –VFS to
+VFS, and how that is used to determine the second bit. etc.

digital values will change. This is shown below in white and black stripes.
Notice that there is no pattern to when the waveform crosses the boundaries. This
is an asynchronous A-D converter. Alternatively you could use a device called a

ESE206 3
“sample-and-hold” to take snapshots of the analog input at fixed intervals. This is what is
commonly done so that recorded data can be read back on at a fixed rate and be
meaningful. However, we’re not recording the data so that won’t be necessary.

Analog to Digital Converter (ADC)


There are many ways of thinking about analog to digital conversion, but within
this lab, it will be most convenient to consider it as a form of division. Determining the
most significant bit (MSB) is trivial. We simply examine the sign of the input. This is
pictured in Figure 2 a. The second bit is more difficult. We must examine the
“remainder” of the first bit. This remainder must exist on the same scale ( − VFS to +VFS )
as the original signal. Once this is clear, then the rest follows as the third bit is simply the
remainder of the second bit and the fourth bit is simply the remainder of the third bit.

Consider the following circuit. In op-amp “A,” the signal AIn is compared to
ground. If it is higher the output of op-amp A goes to approximately -10.5V while if Ain
is lower, the output of the op-amp goes to +10.5V. This signal is led into a voltage
limiter. If the LED has a turn-on voltage of VLED (about 1.9 V) and the diode has a turn-
on voltage of Vdiode (about 0.6 V), then the resulting voltage will be either
+ ( VLED + Vdiode ) or − ( VLED + Vdiode ) ,
depending on the sign of the input. What’s
more, one of the LED’s will be lit, so you can
tell what that sign is. In this case, this is the
most significant bit, telling us which half of
the space the value lies in.
Remember the goal is to provide an
analog output which represents the
“remainder” of the first comparator. This
remainder must be centered and amplified so Figure 4: AIn (blue), DOut (violet), and AOut
that it goes from −VFB to + VFB (Fig. 2b). (green) for the circuit in Fig. 3.
Output of the voltage limiter is then combined
with the original signal through a voltage divider. Remember that our comparator is
providing a negative signal if the voltage is positive and a positive signal if it is negative.
If we perform a weighted average of the output of the comparator with the original input,
it will lower the positive voltages and raise the negative ones. At this point we don’t care
what the amplitude of this signal is, only that it is symmetric around ground. That is,

ESE206 4
Figure 3: Circuit of a 1-bit of the A.D converter.

Vin = VFS ⇒ Vint = a VFS


Vin = 1 2 VFS ⇒ Vint = 0
Vin = 0+ ⇒ Vint = − a VFS
,
Vin = 0− ⇒ Vint = + a VFS
Vin = − 1 2 VFS ⇒ Vint = 0
Vin = -VFS ⇒ Vint = − a VFS
where a is some number less than one. Many of these conditions are redundant.
The signal must then be boosted to full scale again. This is performed by opamp
“B”. A sample plot is shown above in which the blue curve is the original input signal
Ain and the red one Vout.
The signal from Aout could be the input to another stage. While the first stage
determines the most significant bit, the second stage would determine the next bit. A
four-bit ADC would look like the one shown in Fig. 5. Notice that we buffer and invert
the digital outputs so that they are positive when the analog input is positive and so we
can use them to drive a load.

Figure 5: 4 bit analog-to-digital converter in a pipeline fashion consisting of 4 identical stages.

ESE206 5
Digital to Analog Converter (DAC)
After a CD player reads the
values in binary, they must be converted
to an analog signal so that it can be
amplified and sent to the speakers.
A very simple DAC can be
constructed using only resisters. All the
curvy resistors have the same variables
If all the inputs are −Vdig , then the output Figure 6: 4 bit digital-to-analog converter. All
resistors pictured as angled lines have the same
at Vout will be −Vdig . If all the inputs are value.
+Vdig , then the output will be +Vdig . It is
left as part of the prelab to show that.
1
Aout = ( 8 D0 + 4 D1 + 2 D2 + D3 )
15
In practice, this is not the most common style of DAC. Another called an R-2R
resister network is far more prevalent, but the one pictured is far easier to analyze and
will handle bipolar inputs better.

Pre-Lab
1. Determine appropriate values R9, R10, R11, R12, and R13 such that this ADC has a
range from -5V to +5V and the LEDs don’t burn out.
2. Consider only the first stage. Given ±5% on all resistor values, quantify the error in
the “remainder” analog output of stage one. Given that uncertainty, how many bits are
theoretically worthwhile.
3. Analytically show that the resistor network in the DAC is indeed a base two DAC. In
otherwords, Aout = a ( 20 D0 + 2 −1 D1 + 2 −2 D2 + 2 −3 D3 ) + b , where a and b are arbitrary.

Lab Experiment
Equipment:

1. HP function generator/waveform generator (HP 33120A)


2. Power supply
3. HP digital oscilloscope HP 54600
4. LM353 Op-Amps
5. LEDs
6. Diodes
7. Resistors

In-Lab Experiment:

ESE206 6
Figure 7: Overall structure of ADC inline with a DAC.

By end of first week:


Build the circuits pictured in Figs 3, 5, and 7. Do this in steps and verify the proper
functioning of each stage sequentially. Capture the digital output of each stage relative to
AIn. Capture the analog output of the first three stages relative to AIn. Capture a plot
similar to the one shown in Fig 8 below.
DO NOT TAKE APART YOUR CIRCUIT!!!!

By end of second week:


While the “chunky vs smooth” plot shows that you were qualitatively able to develop
both the ADC and the DAC, we will now try to quantitatively characterize both devices
separately.
First, disconnect the ADC from the DAC. Instead of using the function generator
as the analog input, use the “+6” power supply so that you can vary AIN precisely.
Determine at which analog voltages the LED’s flip. (note that you will most likely not be
able to determine the transition between 10002 and 01112.) Plot these values with the
expected results. You will have to be a little creative to get the “+6” power supply to
generate negative voltages.
Second, use the old power supply to create two rails at +2.50 and -2.50. Use
these as the digital drive your DAC. Plot the analog output as a function of digital input.
Determine the differential non-linearity (DNL) of your DAC for each digital output.
V
(VExp,i+1 − VExp,i ) − 2FSn
DNLi =
VFS
2n
The DNL is essentially the relative accuracy of the step sizes are from one digital output
to another in term of the LSB. Also determine the integral non-linearity (INL)
INL = Max ⎡⎣Vexp ,i − Videal ,i ⎤⎦
The INL is essentially the maximum absolute error that the DAC will achieve.
Third, while we rarely even consider both the waveform generator and the
oscilloscope are actually digital devices. The waveform generator is a high-speed DAC
while the oscilloscope is a high-speed ADC. As such, both suffer from discretization
error. Experimentally determine the number of bits used in each device.

ESE206 7
Figure 8: Analog signal (smooth) which has been rendered into digital data and then reformed back into
an analog signal. Below is a plot of the LSB (D3).

Brian Edwards
February 5, 2007

ESE206 8

Potrebbero piacerti anche