32.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 PIR1 register. The ADC Interrupt Enable is the ADIE bit in the PIE1 register. The ADIF bit must be cleared in software.

Important:
  1. The ADIF bit is set at the completion of every conversion, regardless of whether or not the ADC interrupt is enabled.
  2. The ADC operates during Sleep only when the FRC oscillator is selected.

This interrupt can be generated while the device is operating or while in Sleep. If the device is in Sleep, the interrupt will wake up the device. Upon waking from Sleep, the next instruction following the SLEEP instruction is always executed. If the user is attempting to wake up from Sleep and resume in-line code execution, the ADIE bit and the PEIE bit of the INTCON register must both be set, and the GIE bit of the INTCON register must be cleared. If these bits are set, the execution will switch to the Interrupt Service Routine.