The job and the parts
An ADC (analog-to-digital converter) turns a voltage into a whole number. Here Vin = 1.30 V, the reference is 2.00 V and we want 3 bits: 8 codes, one per 0.25 V step. The answer should be 5, binary 101.
A comparator has two inputs, + and −. Its output is 1 when the + input is higher, otherwise 0. It answers one yes-or-no question, so it is a 1-bit converter. Both designs here are built from comparators.
Eight equal resistors share the 2.00 V reference equally, 0.25 V each. The joins between them sit at 0.25, 0.50 ... 1.75 V: seven thresholds, one for each comparator's − input.
Flash: all at once
Vin reaches the + input of all seven comparators at the same moment. The 5 whose threshold is below 1.30 V output 1; the 2 above output 0. Read from the highest down: 0011111, ones below Vin and zeros above, like a thermometer.
An encoder counts the ones: 5, which is 101 in binary. One comparison time and done. The price: 2^N − 1 comparators. 3 bits need 7; 8 bits need 255, so flash is rarely used much past 8 bits.
SAR: one bit per tick
Successive approximation (SAR) uses one comparator several times instead. That takes several clock ticks (beats of the chip's timer), so a sample-and-hold copies Vin onto a capacitor, then opens its switch. The held 1.30 V stays still while the bits are found.
The register tries the top bit: 100. The DAC (digital-to-analog converter) turns 100 into 4 × 0.25 = 1.00 V, half the range. Is 1.30 V higher? Yes, so the 1 stays.
Next it tries 110, which the DAC makes 1.50 V. Is 1.30 V higher? No, so that bit goes back to 0. The code is 100 and the answer lies between 1.00 and 1.50 V.
Last, it tries 101: 1.25 V. 1.30 V is higher, so the bit stays. Three ticks, three bits: 101, the same 5 the flash found. Each tick halved the range left: a binary search.
Flash or SAR?
Flash: 7 comparators, one step. SAR: one comparator, 3 steps (N steps for N bits). Flash wins on speed; SAR on size and power. That is why microcontrollers usually carry a SAR ADC.
The working
# step 1/10 · job
Vref = 2.00 V N = 3 bits
2^N = 8 codes: 0 .. 7
one step (LSB) = Vref / 2^N
= 2.00 / 8 = 0.25 V
Vin = 1.30 V
whole steps below Vin: 1.30 / 0.25 = 5.2
code = 5 -> binary 101
(5 × 0.25 = 1.25 V ≤ 1.30 V < 1.50 V)
plot: the code for every input from 0 to 2 V
Vref = 2.00 V, Vin = 1.30 V and 3 bits are chosen so every number is easy to check; real converters use more bits and their own reference voltage. Every number in the figure is computed from this model. The motion is slowed down a great deal: a real converter does all of this far faster than shown, and the flash finishes in a single comparison time.