Path:AVR-EN => Applications => AVR-D/A-Converter => R/2R calculation basics
DAC8 Tutorial for learning AVR assembly language
for AVR single chip controllers AT90S, ATtiny, ATmega and ATxmega
from ATMEL using practical examples

Simple 8-bit-Digital-to-Analog-Converter with a R/2R Network
Calculation basics of a R/2R network

Calculation basics R/2R net work

Click here to download a zipped version of this page (5.11 MB)
Here, it is demonstrated stepwise how a R/2R network functions and how it can be calculated.


1-Bit-DAC This is a simple One-Bit-DAC.

Depending from the state on the input on bit 0 the DAC generates two different analog voltages: The operating voltage UB is the operating voltage of the AVR driving the output port, e.g. 5.0 V. The half operating voltage results from the resistor divider, which consists of the two 2R resistors. This voltage is divided:
Uout = UB * 2R / (2R + 2R) = UB * 0.5

The upper half of the operating voltage is consumed by the upper resistor.

For the starter three additional notes:


2-bit-DAC Now we add two more resistors, to have a 2-Bit-DAC.

Depending from the state of the two bits not only two different but four voltages result. The states 00, 01, 10 and 11 on the two inputs generate this. Here, the "2R" on the inputs (and on the lower part) and the connection of the lower with the upper bit via a R, half the resistance of the 2R. That causes the name R/2R network.

The same principle can be continued to construct 4-, a 8- or a 10-bit DAC.

Currents in a 2-bit-DAC How it works that the two input pins 0 and 1 contribute so differently to the resulting voltage at UR1 can only be understood by looking at all the currents in the network. The calculation of all those currents is a bit more complicated and requires some algebra, but comes to a simple result. Here is the complete calculation.

Calculation of the 2-bit-DAC

The result of all those calculations in equation (18) is rather simple, all resistors and currents have disappered and the result is nice: both bits contribute to the output voltage by their binary part. Bit 1 one half, bit 0 one fourth.

Equation (19) writes this as a general formula for n bits. Without having to write down douzends of currents through 9 times 2R and 7 times R. That would not fit to a HTML screen, and especially not onto the screen of a mobile phone.

The maximum voltage that a R/2R network provides is not the operating voltage but slightly smaller (due to the lowest 2R to ground). It rather is:
UMax = UB * (2n - 1) / 2n

In case of an 8-bit network and 5.0 V the maximum is 4.98 V.

To the top of that page

©2017 by