34.5 Comparator Interrupt
An interrupt can be generated when either the rising edge or falling edge detector detects a change in the output value of each comparator.
When either edge detector is triggered and its associated enable bit is set (CxINTP and/or CxINTN bits), the corresponding Interrupt Flag bit (the CxIF bit of the PIR2 register) will be set.
To enable the interrupt, the following bits must be set:
- The EN and POL bits
- The CxIE bit of the PIE2 register
- The INTP bit (for a rising edge detection)
- The INTN bit (for a falling edge detection)
- The PEIE and GIE bits of the INTCON register
The associated Interrupt Flag bit, the CxIF bit of the PIR2 register, must be cleared in software. If another edge is detected while this flag is being cleared, the flag will still be set at the end of the sequence.