Datasheet
PIC18F2220/2320/4220/4320
DS39599G-page 34 © 2007 Microchip Technology Inc.
3.3.2 SEC_IDLE MODE
In SEC_IDLE mode, the CPU is disabled but the
peripherals continue to be clocked from the Timer1
oscillator. This mode is entered by setting the IDLEN
bit, modifying to SCS1:SCS0 = 01 and executing a
SLEEP instruction. When the clock source is switched
to the Timer1 oscillator (see Figure 3-5), the primary
oscillator is shut down, the OSTS bit is cleared and the
T1RUN bit is set.
When a wake-up event occurs, the peripherals continue
to be clocked from the Timer1 oscillator. After a 10 μs
delay following the wake-up event, the CPU begins exe-
cuting code, being clocked by the Timer1 oscillator. The
microcontroller operates in SEC_RUN mode until the
primary clock becomes ready. When the primary clock
becomes ready, a clock switch back to the primary clock
occurs (see Figure 3-6). When the clock switch is com-
plete, the T1RUN bit is cleared, the OSTS bit is set and
the primary clock is providing the system clock. The
IDLEN and SCS bits are not affected by the wake-up;
the Timer1 oscillator continues to run.
FIGURE 3-5: TIMING TRANSITION FOR ENTRY TO SEC_IDLE MODE
FIGURE 3-6: TIMING TRANSITION FOR WAKE FROM SEC_RUN MODE (HSPLL)
Note: The Timer1 oscillator should already be
running prior to entering SEC_IDLE mode.
If the T1OSCEN bit is not set when try-
ing to set the SCS0 bit (OSCCON<0>),
the write to SCS0 will not occur. If the
Timer1 oscillator is enabled but not yet
running, peripheral clocks will be delayed
until the oscillator has started; in such sit-
uations, initial oscillator operation is far
from stable and unpredictable operation
may result.
Q4Q3Q2
OSC1
Peripheral
Program
Q1
T1OSI
Q1
Counter
Clock
CPU
Clock
PC + 2PC
12345678
Clock Transition
Q1
Q3 Q4
OSC1
Peripheral
Program
PC PC + 2
T1OSI
PLL Clock
Q1
PC + 6
Q2
Output
Q3
Q4
Q1
CPU Clock
PC + 4
Clock
Counter
Q2
Q2
Q3
Note 1: TOST = 1024 TOSC; TPLL = 2 ms (approx). These intervals are not shown to scale.
Wake-up from Interrupt Event
TOST
(1)
TPLL
(1)
12345678
Clock Transition
OSTS bit Set