25.4.5 Automatic compare function
The compare function can be configured to check whether 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
SC2[ACFGT], SC2[ACREN], and the values in the compare value registers, CV1 and
CV2. After the input is sampled and converted, the compare values in CV1 and CV2 are
used as described in the following table. There are six Compare modes as shown in the
following table.
Table 25-61. Compare modes
SC2[AC
FGT]
SC2[AC
REN]
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.
With SC2[ACREN] =1, and if the value of CV1 is less than or equal to the value of CV2,
then setting SC2[ACFGT] will select a trigger-if-inside-compare-range inclusive-of-
endpoints function. Clearing SC2[ACFGT] will select a trigger-if-outside-compare-
range, not-inclusive-of-endpoints function.
If CV1 is greater than CV2, setting SC2[ACFGT] will select a trigger-if-outside-
compare-range, inclusive-of-endpoints function. Clearing SC2[ACFGT] will select a
trigger-if-inside-compare-range, not-inclusive-of-endpoints function.
If the condition selected evaluates true, SC1n[COCO] is set.
Upon completion of a conversion while the compare function is enabled, if the compare
condition is not true, SC1n[COCO] is not set and the conversion result data will not be
transferred to the result register, Rn. If the hardware averaging function is enabled, the
compare function compares the averaged result to the compare values. The same compare
function definitions apply. An ADC interrupt is generated when SC1n[COCO] is set and
the respective ADC interrupt is enabled, that is, SC1n[AIEN]=1.
Chapter 25 Analog-to-Digital Converter (ADC)
KL02 Sub-Family Reference Manual, Rev. 2.1, July 2013
Freescale Semiconductor, Inc.
369
Содержание KKL02Z32CAF4R
Страница 2: ...KL02 Sub Family Reference Manual Rev 2 1 July 2013 2 Freescale Semiconductor Inc...
Страница 24: ...KL02 Sub Family Reference Manual Rev 2 1 July 2013 24 Freescale Semiconductor Inc...
Страница 36: ...Orderable part numbers KL02 Sub Family Reference Manual Rev 2 1 July 2013 36 Freescale Semiconductor Inc...
Страница 76: ...Human machine interfaces HMI KL02 Sub Family Reference Manual Rev 2 1 July 2013 76 Freescale Semiconductor Inc...
Страница 94: ...Module clocks KL02 Sub Family Reference Manual Rev 2 1 July 2013 94 Freescale Semiconductor Inc...
Страница 142: ...Functional description KL02 Sub Family Reference Manual Rev 2 1 July 2013 142 Freescale Semiconductor Inc...
Страница 188: ...Memory map and register descriptions KL02 Sub Family Reference Manual Rev 2 1 July 2013 188 Freescale Semiconductor Inc...
Страница 214: ...Application information KL02 Sub Family Reference Manual Rev 2 1 July 2013 214 Freescale Semiconductor Inc...
Страница 222: ...Memory map register descriptions KL02 Sub Family Reference Manual Rev 2 1 July 2013 222 Freescale Semiconductor Inc...
Страница 256: ...Memory map and register definition KL02 Sub Family Reference Manual Rev 2 1 July 2013 256 Freescale Semiconductor Inc...
Страница 300: ...Functional description KL02 Sub Family Reference Manual Rev 2 1 July 2013 300 Freescale Semiconductor Inc...
Страница 532: ...Functional description KL02 Sub Family Reference Manual Rev 2 1 July 2013 532 Freescale Semiconductor Inc...
Страница 534: ...KL02 Sub Family Reference Manual Rev 2 1 July 2013 534 Freescale Semiconductor Inc...