Nothing Special   »   [go: up one dir, main page]

Binary Weighted DAC

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 16

Binary Weighted DAC

Binary weighted digital-to-analogue converters are a type of data converter which converts a
digital binary number into an equivalent analogue output signal proportional to the value of
the digital number.

Digital-to-Analogue Converters, or DACs as they are more commonly known, are the
opposite of the Analogue-to-Digital Converters we looked at in a previous tutorial. DACs
convert binary or non-binary numbers and codes into analogue ones with their output voltage
(or current) being proportional to the value of their digital input number. For example, we
may have a 4-bit digital logic circuit that ranges from 0000 to 1111 2, (0 to F16) which a DAC
converts to a voltage output ranging from 0 to 10V.
Converting an “n”-bit digital input code into an equivalent analogue output voltage between 0
and some VMAX value can be done in several ways, but the most common and easily
understood conversion methods use a weighted resistor and a summing amplifier, or an R-2R
resistor ladder network and operational amplifier. Both digital-to-analogue conversion
methods produce a weighted sum output. The weights set by the resistive values used in the
ladder networks contribute a different “weighted” amount to the signals output.
In our tutorial section about Operational Amplifiers, we saw that an inverting amplifier uses
negative feedback to reduce its open-loop gain, AOL, and does so by feeding back a fraction of
its output signal back to the input. We also saw that the input voltage V IN is connected
directly to its inverting input via a resistor R IN and that the inverting amplifier closed-loop
voltage gain, AV(CL) is determined by the ratio of these two resistors as shown.
Then we can see that VOUT is given as VIN multiplied by the closed-loop gain (A CL), which is
determined by the ratio of the feedback resistance, R F to the input resistance, RIN. So, by
altering the values of either R F or RIN we can change the closed-loop gain of the op-amp and
therefore the value of VOUT (IF*Rf) for a given input signal.
Here in this inverting operational amplifier example, we have used a single input voltage
signal, but what if we added another input resistor to combine two or more analogue signals
into a single output, what would be the effect on the circuit and its gain.

Digital-to-Analogue Converter Summing Amplifier


By connecting multiple inputs to the negative terminal of the operational amplifier, we can
convert the single input circuit from above into a summing amplifier or to be more precise, a
“summing inverting voltage amplifier” circuit. As the negative feedback created by the
feedback resistor, RF biases the inverting input of the op-amp at zero potential, and any input
signals are effectively electrically isolated from each other with the output being the inverted
sum of all the input signals combined. Thus, a summing amplifier in the inverting mode
produces the negative sum of any number of input voltages, whereas a non-inverting
summing amplifier would produce the positive sum of any number of input voltages.
Consider the circuit below.

In the summing amplifier circuit above, the output voltage, (V OUT) is proportional to the sum
of the four input voltages, V IN1, VIN2, VIN3, and VIN4 and we can modify the original equation
for the inverting amplifier configuration above to take into account of these four new input
values as follows:
Then we can see that the output voltage is an inverted, scaled sum of the four input voltages
as each input voltage is multiplied by its corresponding gain and added to the next to produce
the total output.
If all the resistances are the same and of an equal value, that is: R F = R1 = R2 = R3 = R4, then
each input channel will have a closed-loop voltage gain of unity (1) so the output voltage is
given simply by:
VOUT = – (VIN1 + VIN2 + VIN3 + VIN4)
If we now assume that the four inputs of the summing amplifier are binary inputs with
voltage values of either 0 or 5 volts (LOW or HIGH, 0 or 1) and we double the resistive
values of each input resistor with regard to the previous one, we can produce an output
condition which would be the weighted sum of these four input voltages creating the basic
circuit for a 4-bit binary-weighted digital-to-analogue converter or 4-bit weighted D/A
converter.
Labelling the four summing inputs as A, B, C, D and making R F = 1kΩ, with the four input
resistors ranging from 1kΩ to 8kΩ (or multiples thereof), we can construct a simple 4-bit
binary-weighted analogue-to-digital converter circuit as shown.

For a 4-bit binary number, there are 2 4 = 16 possible combinations of A, B, C, and D ranging
from 00002 to 11112 which corresponds to decimal 0 to 15 respectively. If we make the
weight of each input bit double with respect to the other, we end up with an 8-4-2-1 binary
code ratio corresponding to 23, 22, 21 and 20.
So, if we set the “D” input resistance at 1kΩ, the “C” input resistance at 2kΩ (that is the
double of D), the “B” input resistance at 4kΩ (double C), and the “A” input resistance at 8kΩ
(double B), with the feedback resistance R F set again at 1kΩ, then the transfer characteristic
of the 4-bit binary-weighted digital-to-analogue converter would be:
So, we can see that if a TTL voltage of +5 volts (logic 1) is applied to the summing
amplifier’s input, VD which represents the most significant bit (MSB), the op-amp’s gain will
be RF/R4 = 1kΩ/1kΩ = 1 (unity). Thus, with a 4-bit binary code of 1000 applied, the output of
the digital-to-analogue converter circuit will be -5 volts.
Likewise, if +5 volts (logic 1) is applied to the summing amplifier’s input V C, the op-amp’s
gain will be RF/R3 = 1kΩ/2kΩ = 1/2 (one half). So, the 4-bit binary code of 0100 would
produce an analogue output voltage of -2.5 volts.
Again, with a logic “1” applied to the summing amplifiers input V B, the op-amp’s gain will
be RF/R2 = 1kΩ/4kΩ = 1/4 (one quarter) with the 4-bit binary code of 0010 producing an
output voltage of -1.25 volts.
Finally, a logic “1” applied to the summing amplifiers input, V A which represents the least
significant bit (LSB), the op-amp’s gain will therefore be RF/R1 = 1kΩ/8kΩ = 1/8 (one eighth)
with the 4-bit binary code of 0001 producing an output voltage of -0.625 volts, (a 12.5%
resolution).
The resolution of this simple 8-4-2-1 binary weighted digital-to-analogue converter will
produce an output voltage change of 0.625 volts per 1-bit change in the binary number, and
we can express this output voltage change in the following table.
4-bit Binary Weighted D/A Converter Output

Where the output voltages are all negative due to the inverting input of the summing
amplifier.
By increasing the number of binary digits and the resistive summing network so that each
resistor has a different weighting, the resolution of the analogue output voltage for a binary-
weighted digital-to-analogue converter can be increased.
For example, an 8-bit DAC with TTL +5 inputs would produce a resolution of 0.039
(1/128*V) volts, while a 12-bit DAC would be 0.00244 (1/2048*V) volts per step (1 LSB)
change of the input binary (or non-binary) code.
Clearly then the disadvantage here is that a binary-weighted resistor DAC requires a large
range of high precision resistors (one per bit) for an “n”-bit DAC making it impractical (and
expensive) for converters with more than a just a few bits of resolution.
But we can expand on this idea of a binary-weighted digital-to-analogue circuit configuration
which uses different value resistors one step further by converting it into an R-2R resistor
ladder DAC which requires only two precision resistance values, namely R and 2R.

R-2R Digital to Analog Converter


R-2R Digital-to-Analogue Converter, or DAC, is a data converter which use two precision
resistors to convert a digital binary number into an analogue output signal proportional to the
value of the digital number.

We saw in the previous tutorial about the binary-weighted digital-to-analogue converter that
the analogue output voltage is the weighted sum of the individual inputs, and that it requires a
large range of precision resistors within its ladder network, making its design both expensive
and impractical for most DAC’s requiring lower levels of resolution.
We also saw that the binary-weighted DAC is based on a closed-loop inverting operational
amplifier using a summing amplifier topology. While this type of data converter
configuration works well for a D/A converter of a few bits of resolution, a much simpler
approach is to use an R-2R resistive ladder network to construct an R-2R Digital-to-Analogue
Converter which requires only two precision resistances.
The R-2R resistive ladder network uses just two resistor values, one which is the base value
“R” and the other which has twice the value, “2R” of the first resistor no matter how many
bits are used to make up the ladder network. So for example, we could just use a 1kΩ resistor
for the base resistor “R”, and therefore a 2kΩ resistor for “2R” (or multiples thereof as the
base value of R is not too critical), thus 2R is always twice the value of R, that is 2R = 2*R.
This means that it is much easier to maintain the required accuracy of the resistors along with
the ladder network compared to the previous weighted resistor DAC. But what is an “R-2R
resistive ladder network” anyway.
R-2R Resistive Ladder Network
As its name implies, the “ladder” description comes from the ladder-like configuration of the
resistors used within the network. An R-2R resistive ladder network provides a simple means
of converting digital voltage signals into an equivalent analogue output. Input voltages are
applied to the ladder network at various points along its length and the more input points the
better the resolution of the R-2R ladder. The output signal as a result of all these input voltage
points is taken from the end of the ladder which is used to drive the inverting input of an
operational amplifier.

Then the R-2R resistive ladder network is nothing more than long strings of parallel and
series-connected resistors acting as interconnected voltage dividers along its length, and
whose output voltage depends solely on the interaction of the input voltages with each other.
Consider the basic 4-bit R-2R ladder network (4-bits because it has four input points) below.

This 4-bit resistive ladder circuit may look complicated, but it’s all about connecting resistors
together in parallel and series combinations and working back to the input source using
simple circuit laws to find the proportional value of the output. Let’s assume all the binary
inputs are grounded at 0 volts, that is: V A = VB = VC = VD = 0V (LOW). The binary code
corresponding to these four inputs will therefore be 0000.
Starting from the left-hand side and using the simplified equation for two parallel resistors
and series resistors, we can find the equivalent resistance of the ladder network as:

Resistors R1 and R2 are in “parallel” with each other but in “series” with resistor R 3. Then we
can find the equivalent resistance of these three resistors and call it R A for simplicity (or any
other form of identification you want).
Then RA is equivalent to “2R”. Now we can see that the equivalent resistance “R A” is in
parallel with R4 with the parallel combination in series with R5.

Again, we can find the equivalent resistance of this combination and call it RB

So, RB combination is equivalent to “2R”. Hopefully, we can see that this equivalent
resistance RB is in parallel with R6 with the parallel combination in series with R7 as shown.

As before we find the equivalent resistance and call it RC.

Again, resistor combination RC is equivalent to “2R” which is in parallel with R8 as shown.


As we have shown above, when two equal resistor values are paralleled together, the
resulting value is one-half, so 2R in parallel with 2R equals an equivalent resistance of R. So,
the whole 4-bit R-2R resistive ladder network comprising of individual resistors connected
together in parallel and series combinations has an equivalent resistance (R EQ) of “R” when a
binary code of “0000” is applied to its four inputs.
Therefore, with a binary code of “0000” applied as inputs, our basic 4-bit R-2R digital-to-
analogue converter circuit would look something like this:
R-2R DAC Circuit with Four Zero (LOW) Inputs

The output voltage for an inverting operational amplifier is given as (R F/RIN) *VIN. If we
make RF equal to R, that is RF = R = 1, and as R is terminated to ground (0V), then there is no
VIN voltage value, (VIN = 0) so the output voltage would be: (1/1) *0 = 0 volts. So, for a 4-bit
R-2R DAC with four grounded inputs (LOW), the output voltage will be “zero” volts, thus a
4-bit digital input of 0000 produces an analogue output of 0 volts.
So, what happens now if we connect input bit V A HIGH to +5 volts. What would be the
equivalent resistive value of the R-2R ladder network and the output voltage from the op-
amp?

R-2R DAC with Input VA


Input VA is HIGH and logic level “1” and all the other inputs grounded at logic level “0”. As
the R/2R ladder network is a linear circuit we can find Thevenin’s equivalent resistance using
the same parallel and series resistance calculations as above to calculate the expected output
voltage. The output voltage, VOUT is therefore calculated at 312.5 millivolts (312.5 mV).

As we have a 4-bit R-2R resistive ladder network, this 312.5 mV voltage change is one-
sixteenth the value of the +5V input (5/0.3125 = 16) voltage so is classed as the Least
Significant Bit, (LSB). Being the least significant bit, input V A will therefore determine the
“resolution” of our simple 4-bit digital-to-analogue converter, as the smallest voltage change
in the analogue output corresponds to a single step change of the digital inputs. Thus, for our
4-bit DAC, this will be 312.5mV (1/16th) for a +5V input.
Now let’s see what happens to the output voltage if we connect input bit V B HIGH to +5
volts.
R-2R DAC with Input VB

With input VB HIGH and logic level “1” and all the other inputs grounded at logic level “0”,
the output voltage, VOUT is calculated at 625mV, which is one-eighth (1/8th) the value of the
+5V input (5/0.625 = 8) voltage. We can also see that it is double the output voltage when
only the input bit VA was applied, and we would expect this as it’s the 2nd bit (input) so has
double the weighting of the 1st bit.
Now let’s see what happens to the output voltage if we connect the input bit V C HIGH to +5
volts.
R-2R DAC with Input VC

With input VC HIGH and logic level “1” and the other input bits at logic level “0”, the output
voltage, VOUT is calculated at 1.25 volts, which is one-quarter (1/4) of the value of the +5V
input (5/1.25 = 4) voltage. Again, we can see that this voltage is double the output of input bit
VB but also 4 times the value of bit V A. This is because input V C is the 3rd bit so has double
the weighting of the 2nd bit and four times the weighting of the 1st bit.

Finally, let’s see what happens to the output voltage if we connect input V D HIGH to +5
volts.
R-2R DAC with Input VD

With only input VD HIGH and logic level “1” and the other inputs at logic level “0”, the
output voltage, VOUT is calculated at 2.5 volts. This is one-half (1/2) the value of the +5V
input (5/2.5 = 2) voltage. Again, we can see that this voltage is double the output of input bit
VC, 4 times the value of bit VB and 8 times the value of input bit VA as it is the 4th bit and
therefore classed as the Most Significant Bit, (MSB).
Then we can see that if input V A represents the LSB and therefore controls the DAC’s
resolution, and input VB is double VA, input VC is four times greater than VA, and input VD is
eight times greater than VA, we can obtain a relationship for the analogue output voltage of
our 4-bit digital-to-analogue converter with the following equation:
Digital-to-Analogue Output Voltage Equation

Where the denominator value of 16 corresponds to the 16 (2 4) possible combinations of


inputs to the 4-bit R-2R ladder network of the DAC.
We can expand this equation further to obtain a generalised R-2R DAC equation for any
number of digital inputs for an R-2R D/A converter as the weighting of each input bit will
always be referenced to the least significant bit (LSB), giving us a generalised equation of:
Generalised R-2R DAC Equation

Where: “n” represents the number of digital inputs within the R-2R resistive ladder network
of the DAC producing a resolution of VLSB = VIN/2n.

Clearly then input bit VA when HIGH will cause the smallest change in the output voltage,
while input bit VD when HIGH will cause the greatest change in the output voltage. The
expected output voltage is therefore calculated by summing the effect of all the individual
input bits which are connected HIGH.
Ideally, the ladder network should produce a linear relationship between the input voltages
and the analogue output as each input will have a step increase equal to the LSB, we can
create a table of expected output voltage values for all 16 combinations of the 4 inputs with
+5V representing a logic “1” condition as shown.

4-bit R-2R D/A Converter Output


Notice that the full-scale analogue output voltage for a binary code of 1111 never reaches the
same value as the digital input voltage (+5V) but is less by the equivalent of one LSB bit,
(312.5mV in this example). However, the higher the number of digital input bits (resolution)
the nearer the analogue output voltage reaches full scale when all the input bits are HIGH.
Likewise, when all the input bits are LOW, the resulting lower resolution of LSB makes
VOUT closer to zero volts.

R-2R Digital-to-Analogue Converter


Now that we understand what an R-2R resistive ladder network is and how it works, we can
use it to produce an R-2R Digital-to-Analogue Converter. Again, using our 4-bit R-2R
resistive ladder network from above and adding it to an inverting operational amplifier
circuit, we can create a simple R-2R digital-to-analogue converter of:

R-2R Digital-to-Analogue Converter

The digital logic circuit used to drive the D/A converter can be generated by combinational or
sequential logic circuits, data registers, counters or simply switches. The interfacing of an R-
2R D/A converter of “n”-bits will depend upon its application. All-in-one boards such as the
Arduino or Raspberry Pi have digital-to-analogue converters built-in so making interfacing
and programming much easier. There are many popular DACs available such as the 8-bit
DAC0808.
R-2R D/A Converter Example No1
A 4-bit R-2R digital-to-analogue converter is constructed to control the speed of a small DC
motor using the output from a digital logic circuit. If the logic circuit uses 10-volt CMOS
devices, calculate the analogue output voltage from the DAC when the input code is
hexadecimal number “B”. Also determine the resolution of the DAC.

1). The hexadecimal letter “B” is equal to the number eleven in decimal. The decimal number
eleven is equal to the binary code “1011” in binary. That is: B 16 = 10112. Thus, for our 4-bit
binary number of 10112, input bit D = 1, bit C = 0, bit B = 1 and bit A = 1.
If we assume that feedback resistor R F is equal to “R”, then our R-2R D/A converter circuit
will look like this:
The digital logic circuit uses 10-volt CMOS devices, so the input voltage to the R-2R
network will be 10 volts. Also being a 4-bit ladder DAC, there will be 2 4 possible input
combinations, so using our equation from above, the output voltage for a binary code of
10112 is calculated as:

Therefore, the analogue output voltage used to control the DC motor when the input code is
10112 is calculated as: -6.875 volts. Note that the output voltage is negative due to the
inverting input of the operational amplifier.
2). The resolution of the converter will be equal to the value of the least significant bit (LSB)
which is given as:
Then the smallest step change of the analogue output voltage, V OUT for a 1-bit LSB change of
the digital input of this 4-bit R-2R digital-to-analogue converter example is 0.625 volts. That
is the output voltage changes in steps or increments of 0.625 volts and not as a straight linear
value.

You might also like