Tricky Problem: Number of Codes and LSB Size for a 12-Bit, 3.3V ADC
Correctly compute an ADC's code count (2^N, not 2^N - 1) and quantization step size (Vref/2^N), and reason precisely about how step size scales with resolution instead of estimating vaguely.
A 12-bit ADC has a 3.3 V reference. Find: (1) the number of codes, (2) the approximate ideal LSB (step size), and (3) what happens to the step size if the resolution changes to 14 bits.
Why This Problem Is Tricky
Two traps sit in this problem. First, 'number of codes' is easy to confuse with 'number of intervals between codes' — an N-bit ADC produces 2^N distinct output codes (0 through 2^N - 1), but there are only 2^N - 1 gaps (quantization steps) between those codes, and mixing these two related-but-different numbers up is a very common off-by-one error. Second, going from 12 bits to 14 bits is only a 2-bit increase, and it is tempting to guess the step size just gets 'somewhat smaller' rather than computing the exact factor, which is a full 4x reduction (2^2), because every additional bit doubles the number of codes.
Step-by-Step Worked Solution
Number of codes for a 12-bit ADC: codes = 2^N = 2^12 = 4096. These are the 4096 distinct digital output values the ADC can produce, numbered 0 through 4095.
Approximate ideal LSB (step size): LSB = Vref / 2^N = 3.3 V / 4096 ≈ 0.0008057 V ≈ 0.806 mV (roughly 805.7 microvolts per code step).
Effect of increasing resolution to 14 bits: codes = 2^14 = 16384. New LSB = 3.3 V / 16384 ≈ 0.0002014 V ≈ 0.201 mV. Comparing the two step sizes: 0.806 mV / 0.201 mV = 4. Going from 12 to 14 bits is a 2-bit increase, and each added bit doubles the code count, so 2 extra bits give 2^2 = 4 times as many codes and therefore exactly 1/4 the step size.
Why the Obvious Wrong Answer Is Wrong
A common wrong answer for part 1 is '4095 codes,' computed as 2^12 - 1. That formula answers a different question — the number of quantization INTERVALS (gaps) between the minimum and maximum code — not the number of codes itself. There really are 4096 distinct output codes for a 12-bit ADC (0 through 4095 inclusive is 4096 values), even though there are only 4095 gaps between them.
A common wrong answer for part 3 is estimating the step size 'gets a bit finer' without computing the exact ratio, or assuming a 2-bit increase in resolution only doubles the precision (matching bit count to factor 1-for-1) rather than recognizing that resolution scales exponentially: doubling resolution requires 2^(delta-bits) as many codes, so a 2-bit increase is a 4x change, not a 2x change.
ADC Resolution Formulas
Number of codes = 2^N
Ideal LSB (step) = Vref / 2^N
Changing resolution by delta bits changes the LSB by a factor of 2^delta
(more bits -> smaller LSB by that factor; fewer bits -> larger LSB by that factor)Code Examples
Both the 12-bit and 14-bit cases are computed independently with the same formula, then compared directly to show the step size shrinks by exactly 2^(delta bits), confirming the 4x relationship rather than assuming it. Expected result: 4096 codes at 12 bits; step size shrinks by 4x at 14 bits.
12-bit: 4096 codes, LSB ~= 0.806 mV. 14-bit: LSB is 4x smaller (~= 0.201 mV).
12-bit ADC, Vref = 3.3 V:
codes = 2^12 = 4096
LSB = 3.3 / 4096 ~= 0.806 mV
14-bit ADC, same Vref:
codes = 2^14 = 16384
LSB = 3.3 / 16384 ~= 0.201 mV
Ratio: 0.806 mV / 0.201 mV = 4 (= 2^(14-12) = 2^2)Quantization Step Comparison
The same 0-3.3V range is divided into 4x more, 4x smaller steps at 14 bits.
12-bit staircase (step = 0.806 mV): ___
___|
___|
___|
14-bit staircase (step = 0.201 mV, 4x finer over the same 3.3V span):
________________________________________________
0V 3.3VWhy This Off-by-One and Scaling Rule Matter
The codes-vs-intervals confusion is a frequent off-by-one bug in real ADC driver firmware when converting a raw reading to a voltage (using the wrong denominator skews every computed voltage slightly). Knowing that step size scales by exactly 2^(delta bits) is essential when choosing an ADC resolution to meet a required measurement precision, for example in audio conversion or sensor front-ends where the required LSB size is specified up front.
4095 codes (using 2^N - 1) 4096 codes (using 2^N) 2^N gives the number of distinct digital output CODES an N-bit ADC produces (0 through 2^N - 1 inclusive, which is 2^N total values). 2^N - 1 instead gives the number of quantization INTERVALS between the minimum and maximum code — a related but different quantity.
How many distinct output codes does a 12-bit ADC produce? A. 4095 B. 4096 C. 2048 D. 8192
B. 4096 — codes = 2^N = 2^12 = 4096. This is the count of distinct digital output values (0 through 4095 inclusive). 4095 (2^12 - 1) is instead the number of quantization intervals between the minimum and maximum code, a related but different number.
Going from a 12-bit ADC to a 16-bit ADC (same reference voltage), the LSB step size becomes how many times smaller? A. 2x smaller B. 4x smaller C. 16x smaller D. 256x smaller
C. 16x smaller — The bit-count increase is 16 - 12 = 4 bits, and step size scales by 2^(delta bits) = 2^4 = 16. So the LSB becomes 16 times smaller, not merely 'somewhat smaller' — resolution scales exponentially with bit count, not linearly.
A 10-bit ADC uses a 5 V reference. Find the number of codes and the approximate LSB.
codes = 2^10 = 1024. LSB = 5 V / 1024 ≈ 4.883 mV.
codes = 2^10; LSB = Vref / codes.