Information
After the selected input is sampled and converted, the result is placed in an accumulator
from which an average is calculated once the selected number of conversions has been
completed. When hardware averaging is selected, the completion of a single conversion
will not set the COCO bit.
If the compare function is either disabled or evaluates true, after the selected number of
conversions are completed, the average conversion result is transferred into the data
result registers, Rn, and the COCO bit is set. An ADC interrupt is generated upon the
setting of COCO if the respective ADC interrupt is enabled (AIEN=1).
Note
The hardware average function can perform conversions on a
channel while the MCU is in Wait or Normal Stop modes. The
ADC interrupt wakes the MCU when the hardware average is
completed if SC1n[AIEN] bit was set.
31.4.5 Automatic compare function
The compare function can be configured to check if the result is less than or greater-than-
or-equal-to a single compare value, or if the result falls within or outside a range
determined by two compare values. The compare mode is determined by ACFGT,
ACREN, and the values in the compare value registers (CV1 and CV2). After the input is
sampled and converted, the compare values (CV1 and CV2) are used as described in the
following table.There are six compare modes as shown in the following table.
Table 31-78. Compare modes
ACFGT ACREN
ADCCV1
relative to
ADCCV2
Function Compare mode description
0 0 — Less than threshold Compare true if the result is less than the
CV1 registers.
1 0 — Greater than or equal to threshold Compare true if the result is greater than or
equal to CV1 registers.
0 1 Less than or
equal
Outside range, not inclusive Compare true if the result is less than CV1
Or the result is greater than CV2.
0 1 Greater than Inside range, not inclusive Compare true if the result is less than CV1
And the result is greater than CV2.
1 1 Less than or
equal
Inside range, inclusive Compare true if the result is greater than or
equal to CV1 And the result is less than or
equal to CV2.
1 1 Greater than Outside range, inclusive Compare true if the result is greater than or
equal to CV1 Or the result is less than or
equal to CV2.
Chapter 31 Analog-to-Digital Converter (ADC)
K20 Sub-Family Reference Manual, Rev. 2, Feb 2012
Freescale Semiconductor, Inc. 617
