Linearity correction is performed by determining whether a data output
value (DOUT) from an analog-to-digital converter (ADC) is in a first
subrange or a second subrange. If DOUT is in the first subrange, then
DOUT is scaled by a first scaling correction factor (SCF1), and the
result is adjusted by a first best fit adjustment value (BFAV1). If DOUT
is in the second subrange, then DOUT is scaled by a second scaling
correction factor (SCF2), and the result is adjusted by a second best fit
adjustment value (BFAV2). The data output range of an ADC can be
processed in many ranges of such subranges. Techniques are set forth for
determining SCF1, SCF2, BFAV1 and BFAV2. Employing the linearity
correction method allows a low-cost microcontroller having an ADC to
perform adequate linearity correction on the ADC output data without
having to store an INL lookup table.