13.1.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.
- Watchdog Timer, if enabled.
- Any external interrupt.
- Interrupts by peripherals capable of running during Sleep (see the 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 in the “Resets” chapter.
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 and will then call the Interrupt Service Routine. In cases where the execution
of the instruction following SLEEP
is not desirable, the user needs to
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.