12.2.1 Wake-up from Sleep
The device can wake up from Sleep through one of the following events:
- External Reset input on MCLR pin, if enabled.
- BOR Reset, if enabled.
- POR Reset.
- Windowed Watchdog Timer, if enabled.
- Any external interrupt.
- Interrupts by peripherals capable of running during Sleep (see individual peripheral for more information).
The first three events will cause a device Reset. The last three events are considered a continuation of program execution. To determine whether a device Reset or wake-up event occurred, refer to the “Determining the Cause of a Reset” section.
When the SLEEP
instruction
is being executed, the next instruction (PC + 1) is prefetched. For the device to wake up
through an interrupt event, the corresponding interrupt enable bit must be enabled. Wake-up
will occur regardless of the state of the GIE bit. If the GIE bit is disabled, the device
continues execution at the instruction after the SLEEP
instruction. If the
GIE bit is enabled, the device executes the instruction after the SLEEP
instruction, the device will then call the Interrupt Service Routine. In cases where the
execution of the instruction following SLEEP
is not desirable, the user
must have a NOP
after the SLEEP
instruction.
The WDT is cleared when the device wakes up from Sleep, regardless of the source of wake-up.