Inside an ADC: flash and successive approximation
لم يُترجم بعد؛ يُعرض باللغة الإنجليزية
عن هذا الدرس
An analog-to-digital converter (ADC) turns a held voltage into a whole number. Follow one input, Vin = 1.30 V, through two 3-bit designs that both answer 5 (binary 101). A flash ADC compares Vin with seven thresholds from a resistor ladder all at once and counts the ones. A successive-approximation (SAR) ADC holds Vin still and finds one bit per clock tick with a single comparator and a DAC: a binary search. It helps to know the Quantization and bit depth lesson, the Circuits lesson on voltage dividers and the lesson on binary numbers.
The job: a voltage becomes a number
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.
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اقرأ الدرس خطوة بخطوة
The job: a voltage becomes a number
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.
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 VThe comparator: one yes-or-no
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.
comparator + input higher than − input -> 1 otherwise -> 0 one comparator = one question "is Vin above this voltage?" flash ADC: 7 comparators, all at once SAR ADC: 1 comparator, asked 3 timesA ladder of thresholds
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.
8 equal resistors in series across Vref each one drops 2.00 / 8 = 0.25 V join k (from the bottom) = k × 0.25 V k = 1: 0.25 V k = 2: 0.50 V k = 3: 0.75 V k = 4: 1.00 V k = 5: 1.25 V k = 6: 1.50 V k = 7: 1.75 V (equal resistors share a voltage equally: see the Circuits lesson on voltage dividers)Flash: all seven compare 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.
1.30 > 1.75 ? no -> 0 1.30 > 1.50 ? no -> 0 1.30 > 1.25 ? yes -> 1 1.30 > 1.00 ? yes -> 1 1.30 > 0.75 ? yes -> 1 1.30 > 0.50 ? yes -> 1 1.30 > 0.25 ? yes -> 1 read top to bottom: 0011111 a "thermometer code": all ones below, all zeros above the level of VinThe encoder counts the ones
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.
ones counted: 5 -> 101 # Python 3 with numpy import numpy as np vin = 1.30 thr = 0.25 * np.arange(1, 8) # taps ones = vin > thr # 7 at once code = int(np.count_nonzero(ones)) print(code, format(code, "03b")) # 5 101 comparators = 2^N − 1 N = 3: 7 N = 8: 255SAR: first, hold the input still
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.
sample-and-hold (S/H) switch closed: the capacitor follows Vin switch open: it keeps 1.30 V why: the SAR needs 3 clock ticks; a changing input would move the target in the middle of the searchTick 1: try the top bit
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.
trial 100 = 4 DAC 4 × 0.25 = 1.00 V compare 1.30 > 1.00 ? yes -> keep 1 code so far: 100 Vin lies between 1.00 and 2.00 VTick 2: try the middle bit
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.
trial 110 = 6 DAC 6 × 0.25 = 1.50 V compare 1.30 > 1.50 ? no -> clear code so far: 100 Vin lies between 1.00 and 1.50 VTick 3: the last bit, done
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.
trial 101 = 5 DAC 5 × 0.25 = 1.25 V compare 1.30 > 1.25 ? yes -> keep 1 result 101 = 5 # Python 3 code = 0 for bit in (4, 2, 1): trial = code | bit if vin > trial * 0.25: # DAC code = trial # keep print(code, format(code, "03b")) # 5 101Flash 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.
flash SAR comparators 2^N − 1 1 steps 1 N N = 3: 7 comps 3 ticks N = 8: 255 comps 8 ticks flash: the very fastest converters SAR: small and low power, common inside microcontrollers
أسئلة سريعة: 5
اختر إجابة واحدة لكل سؤال. يمكنك تغيير اختياراتك قبل التحقق منها.
01What does a comparator output?
A comparator answers one yes-or-no question: is the + input higher than the − input? So its output is a single bit.
02How many comparators does a 4-bit flash ADC need?
A flash ADC needs one comparator per threshold: 2^N − 1. For N = 4 that is 2⁴ − 1 = 15.
03In the 3-bit flash with Vref = 2.00 V, which comparators output 1 for Vin = 0.90 V?
The thresholds are 0.25, 0.50, 0.75, 1.00 ... V. Vin = 0.90 V is above the first three only, so three ones: code 3 = 011.
04A 3-bit SAR ADC (Vref = 2.00 V, steps of 0.25 V) converts 0.60 V. What is its first trial and the result of the first comparison?
A SAR always starts with the top bit: 100, which the DAC makes 4 × 0.25 = 1.00 V, half the range. 0.60 V is lower, so the bit goes back to 0 and the search continues in the lower half.
05Why does a SAR ADC need a sample-and-hold in front of it?
The SAR finds one bit per tick. If the input changed during those ticks, the binary search would chase a moving target, so a switch and capacitor hold it steady. (Filtering is the job of the anti-alias filter, a different part.)
المسرد
- ADC (analog-to-digital converter)
- A circuit that turns a voltage into a whole number (a code) a computer can store.
- Comparator
- A circuit with two inputs that outputs 1 when its + input is higher than its − input, otherwise 0: a 1-bit decision.
- Reference voltage (Vref)
- The voltage the converter measures against; with N bits the input range from 0 to Vref is split into 2^N equal steps.
- LSB (least significant bit) step
- The size of one step, Vref / 2^N; here 2.00 V / 8 = 0.25 V.
- Flash ADC
- A converter that compares the input with every threshold at once using 2^N − 1 comparators, then encodes the result.
- Thermometer code
- The pattern of comparator outputs in a flash ADC: ones for every threshold below the input, zeros above, like the column of a thermometer.
- SAR ADC (successive approximation)
- A converter that finds the code one bit per clock tick, from the most significant bit down, with one comparator and a DAC: a binary search.
- Sample-and-hold
- A switch and a capacitor that copy the input and then hold it steady while a conversion runs.
الملاحظات والمصادر
- 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.
- This ladder of equal resistors puts the thresholds at whole steps, so the code counts the whole steps below Vin (it rounds down). Many real flash ladders shift the ends by half a step so the code rounds to the nearest level instead.
- 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.
- Successive-approximation ADC (Wikipedia): register starts with 1 in the MSB, DAC, comparator keeps or resets the bit, binary search, sample-and-hold, common on microcontrollers
- Flash ADC (Wikipedia): 2^n − 1 comparators, a voltage ladder with a comparator at each rung, impractical much beyond 8 bits
- Analog-to-digital converter (Wikipedia): one bit per clock cycle for SAR; the input held constant during conversion
- Comparator (Wikipedia): compares two voltages and outputs a digital signal indicating which is larger
- Voltage divider (Wikipedia): Vout = R2 / (R1 + R2) × Vin; equal resistors share the voltage equally
- A. V. Oppenheim, R. W. Schafer, J. R. Buck, Discrete-Time Signal Processing, 2nd ed. (course text listed on MIT OCW 6.341 readings): A/D conversion as sample-and-hold plus quantizer
- A. V. Oppenheim, A. S. Willsky, S. H. Nawab, Signals and Systems, 2nd ed., Pearson
- MIT OpenCourseWare 6.003 Signals and Systems (D. Freeman, Fall 2011)
- NumPy documentation: numpy.arange (values in the half-open interval [start, stop))
- NumPy documentation: numpy.count_nonzero
اختبار يتاح بعد الخطوة الأخيرة.