18.4.7 Comparator
Each ADC channel has a dedicated digital comparator that compares the channel conversion result (ADnCHxDATA) with thresholds stored in the ADnCHxCMPLO and ADnCHxCMPHI registers. The following comparison criteria is selected by the CMPMOD[2:0] bits (ADnCHxCON[18:16]):
- Out of bounds (CMPMOD[2:0] bits =
‘
001
’) when ADnCHxCMPLO<ADnCHxDATA or ADnCHxDATA>ADnCHxCMPHI. - In bounds (CMPMOD[2:0] bits =
‘
010
’) when ADnCHxCMPLO≤ADnCHxDATA≤ADnCHxCMPHI. - Greater than (CMPMOD[2:0] bits =
‘
011
’) when ADnCHxDATA>ADnCHxCMPLO. - Less or equal (CMPMOD[2:0] bits =
‘
100
’) when ADnCHxDATA≤ADnCHxCMPLO.
For all other CMPMOD[2:0] bit options, the digital comparator is disabled.
When the comparison match event is detected, the corresponding channel CMPxFLG bit in the ADnCMPSTAT register and the ADnCMPxIF interrupt flag are set.