Electrical · Digital · Investigate
A DAC and an ADC: the missing code
The converter is eight bits. Does it give every one of its 256 codes, and how many bits can it honestly be signed off at?

The bench
An 8-bit R-2R ladder on a breadboard, R = 10 kΩ and 2R = 20 kΩ, 1 % metal film, driven by U3, a 74HC574 on 5.00 V. U3 is fed from the counter, U1 and U2, two 74HC163s clocked at 100 kHz, or from U4, an ATmega328P whose firmware runs a successive approximation: from the top bit down it sets the bit, waits 10 µs and keeps it if U5, a TLV3201 comparator, says the input is above the ladder. The input is a potentiometer or the generator's 0 to 5 V triangle. The scope's CH1 probe is on the ladder's output, CH2 on the input, and its logic channels on U3's outputs. The laptop counts how often each code comes. An MCP6002 and a 74HC4066 are in the parts tray.
What you do
Controls
- U3 fed from: Counter or SAR
- Scope cursor on step: 0 to 255
- Probe on the ladder: ×1 or ×10
- SAR: bits: 4 to 8
- SAR input: Potentiometer or Generator
- Potentiometer, V: 0 to 5
- Generator's triangle: 0 to 5
Buttons
- Record
- Sign the converter off
Stockroom
- The ladder's resistors: As built: 1 % metal film · Rebuilt: 5 % carbon film · Rebuilt: 1 % metal film · Rebuilt: 0.1 % metal film
- Between the ladder and what reads it: Nothing · An MCP6002 follower
- Between the input and the comparator: Nothing: straight in · A hold: 74HC4066 and 10 nF
Unknown
- Board: which code never comes, and why
Predictions
- The converter is eight bits. Fed a slow triangle from 0 to 5 V, the laptop will count…
- The potentiometer is left above 3 V and the scope's probe on the ladder is switched from ×1 to ×10. The code will…
To work out
- Name a code this converter never gives at eight bits, as built. A decimal number.
- Where the staircase steps down furthest on the board as built, how far does it fall? Read it off the scope's cursor, in mV. (mV)
To conclude
- On the board as built, the staircase steps down because…
Results kept
- Steps of the staircase: Step, Ladder (V), From the step before (mV), Probe, Follower, Resistors
- Conversions of the potentiometer: Input (V), Code, Bits, Probe, Follower, Resistors
- Sweeps of the triangle: Triangle, Bits, Hold, Follower, Conversions, Codes seen, Never seen, First never seen, Input moved in a conversion (mV), Resistors
What you find
- A step of the staircase goes down: one count higher, the ladder gives less. Every other step rises by about 19.5 mV, a 256th of 5 V.
- Some codes never come, however the input is swept: the search tries each bit from the top, and where the ladder steps down it can land on the code above but never on those just below it.
- Signed off: at these bits the ladder's resistors promise every step going up, the probe moves no code, and the input holds still to half a step while each conversion is made.
What is simplified
The ladder is solved exactly for every code. Each resistor is a value inside its tolerance, by seed, spread evenly, as parts sorted to a tolerance are: makers promise only the tolerance, and parts spread as a bell inside it would step down less often. U3's outputs are TI's typical 74HC574 at 25 °C, about 31 Ω to the supply and 25 Ω to ground, read along a line between TI's 4.5 and 6 V columns; the supply is exactly 5.00 V and is the ladder's reference. The probe is its resistance alone, 1 MΩ on ×1 and 10 MΩ on ×10; its capacitance (Rigol gives 50 pF and 10 pF) is left out, since with 10 kΩ behind it the ladder settles to half a step in under 6 µs and the firmware waits 10 µs a trial. U5 decides with TI's typical 1 mV offset and 1.2 mV hysteresis, remembering its last answer from one conversion to the next, and no noise. The MCP6002's offsets, up to ±4.5 mV, are taken as nothing, and its slew as quick enough for a trial. The hold takes its voltage as each conversion starts and keeps it exactly: no droop, no step as the switch opens. The counter and U3 change every bit at once, with no glitch between counts, and the scope reads the ladder exactly. Resistors keep their values with temperature. The laptop counts up to 60 000 codes since the last change.
Topics
dac, adc, digital to analog, analog to digital, r-2r ladder, resistor ladder, staircase, successive approximation, sar, comparator, missing code, monotonic, differential nonlinearity, dnl, integral nonlinearity, resolution, accuracy, lsb, resistor tolerance, major carry, sample and hold, track and hold, loading, output resistance, probe, code density, histogram, counter, 74hc574, 74hc163, tlv3201, atmega328p