Learning Objectives:: Topic 5.2.2 - Digital To Analogue Converters
Learning Objectives:: Topic 5.2.2 - Digital To Analogue Converters
Learning Objectives:: Topic 5.2.2 - Digital To Analogue Converters
Learning Objectives:
1
Module ET5
Electronic Systems Applications.
In many situations, real world information exists in analogue form, not digital.
Output devices, such as motors, may rotate faster or slower, rather than
being simply on or off. Sounders may be louder or quieter. Lamps can be
brighter or darker. All of these require analogue signal processing.
PIC microcontrollers are digital devices. They process data in digital form,
and so we often need to convert information from analogue sensors into
digital data, process it with a PIC microcontroller, and then convert the
digital output to an analogue signal again. The first of these operations
requires an Analogue to Digital Converter (ADC). The second requires a
Digital to Analogue Converter (DAC). This section looks at the second of
these devices.
2
Topic 5.2.2 Digital to Analogue Converters
RIN
X
VIN VOUT
0V
The voltage gain formula relies on two properties of the inputs (inverting and
non-inverting) of the op-amp.
1. They both sit at the same voltage, unless the output saturates.
In the inverting amplifier circuit, the non-inverting input is
connected directly to the 0V power rail.
As a result, the inverting input and point X in the circuit diagram,
also sit at 0V.
The voltage at the left-hand end of the input resistor RIN = VIN.
The voltage at the right-hand end of RIN = 0V.
Hence:
(a) the voltage drop across the RIN = VIN,
and (b) the voltage drop across the feedback resistor RF = -VOUT.
3
Module ET5
Electronic Systems Applications.
(The minus sign takes into account the fact that this is an inverting
amplifier a positive input voltage produces a negative output
voltage. Another way to view this is to look at the current flowing
through the feedback resistor see below.)
We next apply the Ohms law formula to obtain expressions for the
currents IIN and IF flowing through RIN and RF respectively:
IIN = VIN / RIN , using (a)
and
IF = -VOUT / RF, using (b)
The next step is to add a second input resistor, supplied with its own voltage
signal. The labels have been changed so that the two input voltages can be
identified separately. The new circuit diagram is:
RF
R2
R1
V2
V1 VOUT
0V
4
Topic 5.2.2 Digital to Analogue Converters
Providing that the output is not saturated, the inverting input and the non-
inverting input still sit at 0V.
The voltage drop across R1 is still V1, and so the current flowing through R1 is:
I 1 = V1 / R1
Similarly, the voltage drop across R2 is V2 and the current through it is:
I2 = V2 / R2
As before, the current through the feedback resistor is:
IF = - VOUT / RF
When we ignore the tiny currents flowing in the op-amp inputs we get:
IF = I1 + I2
Substituting the values from the earlier equations:
- VOUT / RF = V1 / R1 + V2 / R2
This can be re-arranged to give :
VOUT = -RF (V1 / R1 + V2 / R2)
This is the equation for the summing amplifier. Notice that it is the input
currents that are summed as they flow through the feedback resistor.
In fact, the gain formula could be written, (but isnt!) as:
VOUT = -RF (I1 + I2)
Further input signals can be added, each with its own input resistor, as shown
in the following circuit diagram for a four channel summing amplifier:
RF
R4
R3
R2
V4
V3 R1
V2
V1 VOUT
0V
5
Module ET5
Electronic Systems Applications.
VOUT
0V
The output voltage will be:
VOUT = -100 (2 / 100 + 1.4 / 56 + 0.2 / 10 + 0.11 / 22)
= -7V
Now back to the task in hand, the DAC, and examinable content!
Digital signals
6
Topic 5.2.2 Digital to Analogue Converters
The DAC circuit must take into account both of these properties:
The input voltages will be one of two values, either that representing
logic 0, usually 0V, or that representing logic 1, usually close to the
positive supply voltage (+VS).
The output voltage must take into account the place value of the logic
1 input signals, by having a voltage gain that reflects this place value.
In other words, if the input receiving the least significant bit (lsb)
has a voltage gain of G, then the input connected to the next bit
must have a gain of 2G, the next input a gain of 4G, and so on.
In DAC circuits based on the summing amplifier, this is achieved by
successively reducing the size of the input resistor. When the lsb
input resistor is R, the next input resistor will be R/2, the next R/4
and so on.
The design is based on an inverting amplifier, and so, when using positive logic
(logic 1 = +VS,) the output voltage is negative. (The circuit must be powered
from a split power supply, offering voltage rails at +VS, 0V and VS.) To
overcome the inversion, a second inverting amplifier often follows the first.
This may simply have a voltage gain of -1.
7
Module ET5
Electronic Systems Applications.
The next circuit diagram shows these ideas incorporated into a 4 bit DAC:
V1 Analogue V
OUT
output
0V
To analyse the above circuit, assume that 0V represents a logic 0 signal, and
+12V a logic 1. Think of it as four inverting amplifiers combined so that the
output voltage is the sum of their outputs. The second op-amp has a voltage
gain of -1, and so simply reverses the polarity of the output signal.
For example:
Input the binary number 0001,
i.e. A = 12V and B = C = D = 0V.
Voltage gain on As input = - RF / RIN = - 10/240,
so its output = - 12 x 10/240 = -0.5V.
The other inputs are set to 0V and so they output 0V.
The final output = - (-0.5 + 0 + 0 + 0) = +0.5V
8
Topic 5.2.2 Digital to Analogue Converters
Calculate the output voltage VOUT when the following binary numbers are
applied to the input:
(a) 0111
(b) 1101
(c) 1111
9
Module ET5
Electronic Systems Applications.
The behaviour of the four bit DAC can be summarised in two ways as a table
of output voltages, or as a graph. Both of these are shown below.
Binary number
input V1 /V VOUT /V
D C B A
0 0 0 0 0 0
0 0 0 1 -0.5 0.5
0 0 1 0 -1.0 1.0
0 0 1 1 -1.5 1.5
0 1 0 0 -2.0 2.0
0 1 0 1 -2.5 2.5
0 1 1 0 -3.0 3.0
0 1 1 1 -3.5 3.5
1 0 0 0 -4.0 4.0
1 0 0 1 -4.5 4.5
1 0 1 0 -5.0 5.0
1 0 1 1 -5.5 5.5
1 1 0 0 -6.0 6.0
1 1 0 1 -6.5 6.5
1 1 1 0 -7.0 7.0
1 1 1 1 -7.5 7.5
V /V
OUT
7.0
6.0
5.0
4.0
3.0
2.0
Step size = 0.5V
1.0
D CBA
Input
0000
001 0
0001
0100
1000
0101
1001
001 1
0110
1010
1100
1011
1101
1110
0111
1111
10
Topic 5.2.2 Digital to Analogue Converters
Notice that the step size depends on the voltage gain of the least significant
input of the DAC (and the voltage that represents logic 1.)
390k
VOUT
0V
Analyse the performance of this circuit by producing a table to show how the
output voltage varies as increasing binary numbers are applied to the input.
Then plot these results as a graph of output voltage against input number.
11
Module ET5
Electronic Systems Applications.
In general, a n bit DAC will have 2n output voltage levels, with 2n 1 steps
between them.
As can be seen on the graph on page 10, a four bit DAC produces sixteen (=2 4)
output voltage levels, with fifteen steps (24 1) between them.
These fifteen steps must cover the 0 to 12V voltage range, so that each step
is a voltage change of (12 / 15) V, = 0.8V.
12
Topic 5.2.2 Digital to Analogue Converters
In order to get the correct weighting for the voltage gains for the four
inputs, the input resistors are in the ratio R1, R1/2, R1/4 and R1/8.
VOUT
0V
The two resistors used in the second inverting amplifier can have any value,
as long as both are equal (to give a voltage gain of -1) and have resistance
greater than 1k (to reduce the size of the current flowing in them, and
hence the power dissipated.)
13
Module ET5
Electronic Systems Applications.
1. A microprocessor systems can contain both an analogue-to-digital converter (ADC) and a digital-to-
analogue converter (DAC)
Here is the circuit diagram for a digital-to-analogue converter (DAC).
120k
A 30k 100k
60k
B
30k 100k
C
A m p X A m p Y
V1 V2
The most significant bit of the binary number is applied to input C, and the least significant
bit to input A. The outputs of the op-amps saturate at +12V and -12V.
(i) What is the gain of amplifier Y? [1]
..
(ii) The following voltages are applied to inputs A, B and C.
VA = +5V
VB = 0V
VC = 0V
Calculate:
V1 [1]
..
..
V2 [1]
..
..
14
Topic 5.2.2 Digital to Analogue Converters
(iii) The system uses +5V to represent logic 1 and 0V to represent logic 0.
Use the axes provided to draw a graph showing the relationship between V2 and the digital
input signal, for the four values of input given. Indicate the scale you are using for the
vertical axis. [2]
Voltage/V
Output
V2 0
000 001 010 011 100
Digital input
(iv) What is the maximum value of output voltage V2 that this 3- bit DAC will produce? [1]
..
15
Module ET5
Electronic Systems Applications.
2. (a) The diagram shows the circuit for a 3-bit linear digital-to-analogue converter (DAC), based on a
summing amplifier.
R1 R4
A
R2
B
Output
R3
C
0V
(i) Calculate suitable values for the resistors used in the circuit, so that the DAC has the following
characteristics:
Digital input Output
C B A voltage
0 0 0 0V
0 0 1 - 0.5V
..
..
..
..
R1 =
R2 =
R3 =
R4 =
16
Topic 5.2.2 Digital to Analogue Converters
Initially, the counter is reset. Then ten pulses are sent into the counter.
Use the axes provided to sketch the resulting output signal VOUT as this happens. [3]
Output
Vol tage/V
10
8
6
4
2
0
0 1 2 3 4 5 6 7 8 9 10
Number of pulses
-2
-4
-6
-8
-10
17
Module ET5
Electronic Systems Applications.
Solutions to Exercises:
Exercise 1:
See the results given in the table on page 10.
Exercise 2:
Table of results -
Binary number
VOUT / V
C B A
0 0 0 0
0 0 1 0.8
0 1 0 1.6
0 1 1 2.4
1 0 0 3.2
1 0 1 4.0
1 1 0 4.8
1 1 1 5.6
Graph of results
V /V
OUT
7.0
6.0
5.6
5.0
4.0
1.0
Input
CBA
000
100
001
010
101
110
011
111
18
Topic 5.2.2 Digital to Analogue Converters
Exercise 3:
20k 4k
A
10k
B
5k 220k
C
220k
VOUT
0V
19