![](http://datasheet.mmic.net.cn/Atmel/ATTINY861A-MUR_datasheet_96601/ATTINY861A-MUR_258.png)
PIC18CXX8
DS30475A-page 258
Advanced Information
2000 Microchip Technology Inc.
22.3.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 an interrupt condition (interrupt flag bit and inter-
rupt enable bits are set) occurs before the execu-
tion of a SLEEP instruction, the SLEEP instruction
will complete as a NOP. Therefore, the WDT and
WDT postscaler will not be cleared, the TO bit will
not be set and PD bits will not be cleared.
If the interrupt condition occurs during or after
the execution of a SLEEP instruction, the device
will immediately wake-up from sleep. The SLEEP
instruction will be completely executed before the
wake-up. Therefore, the WDT and WDT
postscaler will be cleared, the TO bit will be set
and the 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.
To ensure that the WDT is cleared, a CLRWDT instruc-
tion should be executed before a SLEEP instruction.
FIGURE 22-2: WAKE-UP FROM SLEEP THROUGH INTERRUPT(1,2)
Q1
Q2
Q3 Q4
Q1 Q2
Q3
Q4
Q1
Q2 Q3 Q4
Q1 Q2 Q3 Q4
Q1
Q2 Q3
Q4
Q1 Q2
Q3
Q4
OSC1
CLKOUT(4)
INT pin
INTIF bit
GIEH bit
INSTRUCTION FLOW
PC
Instruction
fetched
Instruction
executed
PC
PC+2
PC+4
Inst(PC) = SLEEP
Inst(PC - 1)
Inst(PC + 2)
SLEEP
Processor in
SLEEP
Interrupt Latency(3)
Inst(PC + 4)
Inst(PC + 2)
Inst(0008h)
Inst(000Ah)
Inst(0008h)
Dummy cycle
PC + 4
0008h
000Ah
Dummy cycle
TOST(2)
PC+4
Note 1:
XT, HS or LP oscillator mode assumed.
2:
GIE set is assumed. In this case, after wake- up, the processor jumps to the interrupt routine.
If GIE is cleared, execution will continue in-line.
3:
TOST = 1024TOSC (drawing not to scale). This delay will not occur for RC and EC osc modes.
4:
CLKOUT is not available in these oscillator modes, but shown here for timing reference.