13.1.2 Wake-up Using Interrupts

When global interrupts are disabled (GIE cleared) and any interrupt source has both its interrupt enable bit and interrupt flag bit set, one of the following will occur:

  • If the interrupt occurs before the execution of a SLEEP instruction
    • SLEEP instruction will execute as a NOP
    • WDT and WDT prescaler will not be cleared
    • TO bit will not be set
    • PD bit will not be cleared
  • If the interrupt occurs during or after the execution of a SLEEP instruction
    • SLEEP instruction will be completely executed
    • Device will immediately wake-up from Sleep
    • WDT and WDT prescaler will be cleared
    • TO bit will be set
    • PD bit will be cleared

Even if the flag bits were checked before executing a SLEEP instruction, it may be possible for flag bits to become set before the SLEEP instruction completes. To determine whether a SLEEP instruction executed, test the PD bit. If the PD bit is set, the SLEEP instruction was executed as a NOP.