41.1.5 Interrupts
The ADC module allows for the ability to generate an interrupt upon completion of an Analog-to-Digital Conversion. The ADC interrupt flag is the ADIF bit in the PIRx register. The ADC interrupt enable is the ADIE bit in the PIEx register. The ADIF bit must be cleared by software.
Important:
- The ADIF bit is set at the completion of every conversion, regardless of whether or not the ADC interrupt is enabled.
- The ADC operates during Sleep only when the ADCRC oscillator is selected.
The ADC Interrupt can be generated while the device is operating or while in Sleep. While
the device is operating in Sleep mode:
- If ADIE =
1
, GIEL =1
, and GIE =0
: An interrupt will wake the device from Sleep. Upon waking from Sleep, the instructions following theSLEEP
instruction are executed. The Interrupt Service Routine is not executed. - If ADIE =
1
, GIEL =1
, and GIE =1
: An interrupt will wake the device from Sleep. Upon waking from Sleep, the instruction following theSLEEP
instruction is always executed. Then the execution will switch to the Interrupt Service Routine.