the digital-to-analog converter (DAC)
/ DAC, said 'dack' or D-A-C /
A digital-to-analog converter is the translator that turns numbers back into a real voltage — the way out of the digital world. The processor hands it a binary number and the DAC produces a matching voltage on its output pin. Think of a volume knob driven by software: send the number for 'one quarter' and the output sits at one quarter of full scale. It is how a chip makes sound, draws a smooth waveform, or sets a precise control voltage.
The core idea is a weighted sum tied to a reference voltage. Each bit of the input number controls a piece of the output, with each higher bit worth twice the one below it, and the reference sets the full-scale value. For an n-bit DAC, Vout = Vref times (code / 2^n). Work an example: an 8-bit DAC with a 4.00 V reference, given the code 192 (which is 11000000 in binary), outputs 4.00 V times 192/256 = 3.00 V. Send code 0 and you get 0 V; send 255 and you get nearly the full 4.00 V (one LSB short). The output moves in discrete steps of one LSB, here 4.00/256 = 15.6 mV.
Why this matters: DACs are everywhere a digital system has to act on the analog world — audio, video, motor control, instrument outputs, and as the heart of many ADCs. The output is a staircase, not a smooth curve, so it carries steps and high-frequency images that a reconstruction (smoothing) filter must round off afterward. The two classic ways to build the weighted sum, binary-weighted and the R-2R ladder, trade off how many different precise resistor values you need against how wide a range of values you must match.
A 12-bit DAC with a 3.3 V reference has 4,096 steps of 3.3/4096 = 0.806 mV each. To output 1.000 V you send the nearest code: round(1.000 / 0.806 mV) = code 1241, which produces 1241 times 0.806 mV = 1.0003 V.
A number in, a matching staircase voltage out, scaled by the reference.
A DAC's accuracy is no better than its voltage reference — every output is a fraction of Vref, so reference drift or noise scales straight onto the analog output. A precise DAC fed a sloppy reference gives sloppy voltages.