13.2.1 Wake-Up from Sleep

The device can wake up from Sleep through one of the following events:

  1. External Reset input on MCLR pin, if enabled.
  2. BOR Reset, if enabled.
  3. Low-Power Brown-out Reset (LPBOR), if enabled.
  4. POR Reset.
  5. Windowed Watchdog Timer, if enabled.
  6. All interrupt sources except clock switch interrupt can wake up the part.
Important: The first five events will cause a device Reset. The last event in the list is considered a continuation of program execution. For more information about determining whether a device Reset or wake-up event occurred, refer to the “Resets” chapter.

When the SLEEP instruction is being executed, the next instruction (PC + 2) is prefetched. For the device to wake up through an interrupt event, the corresponding Interrupt Enable bit must be enabled in the PIEx register. Wake-up will occur regardless of the state of the Global Interrupt Enable (GIE) bit. If the GIE bit is disabled, the device will continue execution at the instruction after the SLEEP instruction. If the GIE bit is enabled, the device executes the instruction after the SLEEP instruction and then call the Interrupt Service Routine (ISR).

Important: It is recommended to add a NOP as the immediate instruction after the SLEEP instruction.

The WDT is cleared when the device wakes up from Sleep, regardless of the source of wake-up. Upon a wake-from-Sleep event, the core will wait for a combination of three conditions before beginning execution. The conditions are:

  • PFM Ready
  • System Clock Ready
  • BOR Ready (unless BOR is disabled)