18.4.8 Interrupts
Each channel has an individual result ready interrupt with an ADnCHxIF flag in the corresponding IFS register. The channel interrupt can be enabled by setting the ADnCHxIE bit in the IEC register.
The channel interrupt is generated:
- After each conversion for the single conversion
mode (MODE[1:0] bits = ‘
00
’). - For the window mode (MODE[1:0] bits =
`
01
') when the number of conversions reaches a value in the CNTx[15:0] bits (ADnCHxCNT[15:0]) or when the gate signal defined by the TRG1SRC[4:0] bits is deasserted. - When all conversions are finished for the
oversampling or integration modes (MODE[1:0] bits = ‘
10
’ or ‘11
’).
The result ready interrupt can be generated before the result is available in the ADnCHxDATA
register. This feature is called “Early Interrupt” and can reduce the ADC channel
interrupt latency. This early interrupt for the channel is enabled by setting of the
EIEN bit (ADnCHxCON[24]). Early interrupts can only be used in single conversion mode
(MODE[1:0] bits = ‘00
’). When the early interrupt is enabled (EIEN bit
= ‘1
’), the channel individual interrupt is generated and the CHxRDY
bit in the ADnSTAT register is set at the start of the sampling time. The software must
guarantee that the channel data are ready when the ADnCHxDATA register is read in the
Interrupt Service Routine.
Each channel also has a comparator interrupt with the ADnCMPxIF flag in the corresponding IFS register. The channel comparator interrupt is generated on the comparator match event. The comparator interrupt can be enabled by setting the ADnCMPxIE bit in the IEC register.