25.5 Initialization information
This section gives an example that provides some basic direction on how to initialize and
configure the ADC module. The user can configure the module for 12-bit, 10-bit, or 8-bit
single-ended resolution, single or continuous conversion, and a polled or interrupt
approach, among many other options. For information used in this example, refer to
,
Note
Hexadecimal values are designated by a preceding 0x, binary
values designated by a preceding %, and decimal values have
no preceding character.
25.5.1 ADC module initialization example
25.5.1.1 Initialization sequence
Before the ADC module can be used to complete conversions, an initialization procedure
must be performed. A typical sequence is:
1. Calibrate the ADC by following the calibration instructions in
.
2. Update CFG to select the input clock source and the divide ratio used to generate
ADCK. This register is also used for selecting sample time and low-power
configuration.
3. Update SC2 to select the conversion trigger, hardware or software, and compare
function options, if enabled.
4. Update SC3 to select whether conversions will be continuous or completed only once
(ADCO) and whether to perform hardware averaging.
5. Update SC1:SC1n registers to enable or disable conversion complete interrupts.
Also, select the input channel which can be used to perform conversions.
Chapter 25 Analog-to-Digital Converter (ADC)
KL02 Sub-Family Reference Manual, Rev. 2.1, July 2013
Freescale Semiconductor, Inc.
375