DAC Scaling
Map digital codes to analog outputs and quantify rounding error.
Formulas
D = 2ᴺ or 2ᴺ − 1; Vdac = code × Vref / D
Vout = G × Vdac + Voffset; output step = G × Vref / D
Required code = clamp(round[(Vdesired − Voffset) / output step], 0, 2ᴺ − 1)
Quantization error = achieved output at required code − Vdesired
Model & assumptions
Ideal unipolar voltage DAC plus positive external gain. Amplifier supply limits, settling, offset error, and INL are excluded.
Ideal LSB uses a 2ᴺ denominator; endpoint mode reaches Vref at the highest code. Choose the convention from the actual datasheet.
Example with default inputs
- Final analog output
- 3.3 V
- DAC pin output
- 1.65 V
- Required DAC code
- 3,103 counts
- Achievable desired output
- 4.99995 V
- Output voltage per step
- 1.61133 mV
- Quantization / clipping error
- -48.8281 µV
- Maximum analog output
- 6.59839 V