2. Add the plus-side calibration results CLP0, CLP1, CLP2, CLP3, CLP4, and CLPS tothe variable.3. Divide the variable by two.4. Set the MSB of the variable.5. The previous two steps can be achieved by setting the carry bit, rotating to the rightthrough the carry bit on the high byte and again on the low byte.6. Store the value in the plus-side gain calibration register PG.When calibration is complete, the user may reconfigure and use the ADC as desired. Asecond calibration may also be performed, if desired, by clearing and again settingSC3[CAL].Overall, the calibration routine may take as many as 14k ADCK cycles and 100 buscycles, depending on the results and the clock source chosen. For an 8 MHz clock source,this length amounts to about 1.7 ms. To reduce this latency, the calibration values, whichare offset, plus-side gain, and plus-side calibration values, may be stored in flash memoryafter an initial calibration and recovered prior to the first ADC conversion. This methodcan reduce the calibration latency to 20 register store operations on all subsequent power,reset, or Low-Power Stop mode recoveries.28.4.7 User-defined offset functionOFS contains the user-selected or calibration-generated offset error correction value. Thisregister is a 2’s complement, left-justified. The value in OFS is subtracted from theconversion and the result is transferred into the result registers, Rn. If the result is greaterthan the maximum or less than the minimum result value, it is forced to the appropriatelimit for the current mode of operation.The formatting of the OFS is different from the data result register, Rn, to preserve theresolution of the calibration value regardless of the conversion mode selected. Lowerorder bits are ignored in lower resolution modes. For example, in 8-bit single-endedmode, OFS[14:7] are subtracted from D[7:0]; OFS[15] indicates the sign (negativenumbers are effectively added to the result) and OFS[6:0] are ignored.OFS is automatically set according to calibration requirements once the self-calibrationsequence is done, that is, SC3[CAL] is cleared. The user may write to OFS to overridethe calibration result if desired. If the OFS is written by the user to a value that isdifferent from the calibration value, the ADC error specifications may not be met. Storingthe value generated by the calibration function in memory before overwriting with a user-specified value is recommended.Functional descriptionKL04 Sub-Family Reference Manual, Rev. 3.1, November 2012450 Freescale Semiconductor, Inc.