Microchip Technology MCU PIC PIC18F87K22-I/PTRSL TQFP-80 MCP PIC18F87K22-I/PTRSL Data Sheet

Product codes
PIC18F87K22-I/PTRSL
Page of 550
PIC18F87K22 FAMILY
DS39960D-page 64
 2009-2011 Microchip Technology Inc.
4.4.3
RC_IDLE MODE
In RC_IDLE mode, the CPU is disabled but the periph-
erals continue to be clocked from the internal oscillator
block using the INTOSC multiplexer. This mode
provides controllable power conservation during Idle
periods.
From RC_RUN, this mode is entered by setting the
IDLEN bit and executing a SLEEP instruction. If the
device is in another Run mode, first set IDLEN, then set
the SCS1 bit and execute SLEEP. To maintain software
compatibility with future devices, it is recommended
that SCS0 also be cleared, though its value is ignored.
The INTOSC multiplexer may be used to select a
higher clock frequency by modifying the IRCF bits
before executing the SLEEP instruction. When the
clock source is switched to the INTOSC multiplexer, the
primary oscillator is shut down and the OSTS bit is
cleared.
If the IRCF bits are set to any non-zero value, or the
INTSRC/MFIOSEL bit is set, the INTOSC output is
enabled. The HFIOFS/MFIOFS bits become set, after
the INTOSC output becomes stable, after an interval of
T
IOBST
 (Parameter
). (For information
on the HFIOFS/MFIOFS bits, see 
Clocks to the peripherals continue while the INTOSC
source stabilizes. The HFIOFS/MFIOFS bits will
remain set if the IRCF bits were previously at a non-
zero value or if INTSRC was set before the SLEEP
instruction was executed and the INTOSC source was
already stable. If the IRCF bits and INTSRC are all
clear, the INTOSC output will not be enabled, the
HFIOFS/MFIOFS bits will remain clear and there will be
no indication of the current clock source.
When a wake event occurs, the peripherals continue to
be clocked from the INTOSC multiplexer. After a delay
of T
CSD
 (Parameter 
) following the
wake event, the CPU begins executing code clocked
by the INTOSC multiplexer. The IDLEN and SCS bits
are not affected by the wake-up. The INTRC source will
continue to run if either the WDT or the Fail-Safe Clock
Monitor is enabled.
4.5
Selective Peripheral Module 
Control
Idle mode allows users to substantially reduce power
consumption by stopping the CPU clock. Even so,
peripheral modules still remain clocked, and thus,
consume power. There may be cases where the appli-
cation needs what this mode does not provide: the
allocation of power resources to the CPU processing
with minimal power consumption from the peripherals.
PIC18F87K22 family devices address this requirement
by allowing peripheral modules to be selectively
disabled, reducing or eliminating their power
consumption. This can be done with two control bits:
• Peripheral Enable bit, generically named XXXEN – 
Located in the respective module’s main control 
register
• Peripheral Module Disable (PMD) bit, generically 
named, XXXMD – Located in one of the PMDx 
Control registers (PMD0, PMD1, PMD2 or PMD3)
Disabling a module by clearing its XXXEN bit disables
the module’s functionality, but leaves its registers
available to be read and written to. This reduces power
consumption, but not by as much as the second
approach.
Most peripheral modules have an enable bit.
In contrast, setting the PMD bit for a module disables
all clock sources to that module, reducing its power
consumption to an absolute minimum. In this state, the
control and status registers associated with the periph-
eral are also disabled, so writes to those registers have
no effect and read values are invalid. Many peripheral
modules have a corresponding PMD bit.
There are four PMD registers in the PIC18F87K22 family
devices: PMD0, PMD1, PMD2 and PMD3. These
registers have bits associated with each module for
disabling or enabling a particular peripheral.