A simple 4-bit digital-to-analog converter that is constructed from a digitally controlled switch (74HC4066), a set of binary-weighted resistors, and an operational amplifier. The basic idea is to create an inverting amplifier circuit whose gain is controlled by changing the input resistance Rin. The 74HC4066 and the resistors together act as a digitally controlled Rin that can take on one of 16 possible values. (You can think of the 74HC4066 and resistor combination as a digitally controlled current source. Each new binary code applied to the inputs of the 74HC4066 generates a new discrete current level that is summed by RF to provide a new discrete output voltage level.) We choose scaled resistor values of R, R/2, R/4, and R/8 to give Rin discrete values that are equally spaced. To find all possible values of Rin, we use the formula provided. This formula looks like the old resistors- in-parallel formula, but we must exclude those resistors which are not selected by the digital input code-that’s what the coefficients A through D are for (a coefficient is either 1 or 0, depending on the digital input).

Now, to find the analog output voltage, we simply use Vout = −Vin (RF/Rin)-the expression used for the inverting amplifier shows what we get when we set Vin = −5 V, R = 100 kΩ, and RF = 20 kΩ, and take all possible input codes. The binary-weighted DAC shown above is limited in resolution (4-bit, 16 analog levels). To double the resolution (make an 8-bit DAC), you might think to add another 74HC4066 and R/16, R/32, R/64, and R/128 resistors. In theory, this works; in reality, it doesn’t. The problem with this approach is that when we reach the R/128 resistor, we must find a 0.78125-kΩ resistor, assuming R = 100 kΩ. Assuming we can find or construct an equivalent resistor network for R/128, we’re still in trouble because the tolerances of these resistors will screw things up. This scaled-resistor approach becomes impractical when we deal with resolutions of more than a few bits.

To increase the resolution, we scrap the scaled-resistor network and replace it with an R/2R ladder network-the manufacturers of DAC ICs do this as well. An R/2R DAC uses an R/2R resistor ladder network instead of a scaled-resistor network, as was the case in the previous DAC. The benefit of using the R/2R ladder is that we need only two resistor values, R and 2R. The trick to understanding how the R/2R ladder works is realizing that the current drawn through any one switch is always the same, no matter if it is thrown up or thrown down. If a switch is thrown down, current will flow through the switch into ground (0 V). If a switch is thrown up, current will flow toward virtual ground- located at the op amp’s inverting input (recall that if the non inverting input of an op amp is set to 0 V, the op amp will make the inverting input 0 V, via negative feedback). Once you realize that the current through any given switch is always constant, you can figure that the total current (I) supplied by Vref will be constant as well. Once you’ve got that, you figure out what fractions of the total current passes through each of the branches within the R/2R network using simple circuit analysis.