ADC Formulas
$$
\begin{aligned}
\text{LSB} &= \frac{V_{ref}}{2^N} \\
D_{max} &= 2^N – 1 \\
D &= \left\lfloor \frac{V_{in}}{V_{ref}} \cdot 2^N \right\rfloor \\
V_q &= D \cdot \text{LSB} \\
E_q &= V_{in} – V_q \\
D &= D_{max} \quad \text{if } V_{in} \ge V_{ref}
\end{aligned}
$$
$$
\begin{aligned}
D_{max,\;bin} &= \text{Binary}(D_{max}) \\
D_{max,\;hex} &= \text{Hex}(D_{max}) \\
D_{bin} &= \text{Binary}(D) \\
D_{hex} &= \text{Hex}(D)
\end{aligned}
$$
$$ \begin{aligned} N &= \text{Resolution (bits)} \\ V_{ref} &= \text{Reference Voltage} \\ V_{in} &= \text{Analog Input Voltage} \\ D &= \text{Digital Output Code} \\ V_q &= \text{Quantized Output Voltage} \\ E_q &= \text{Quantization Error} \end{aligned} $$