Microchip Technology MA240029 データシート

ページ / 406
PIC24FJ128GA310 FAMILY
DS39996F-page 156
 2010-2011 Microchip Technology Inc.
TABLE 10-2:
EXITING POWER SAVING MODES
10.1.1
INSTRUCTION-BASED 
POWER-SAVING MODES
Three of the power-saving modes are entered through
the execution of the PWRSAV instruction. Sleep mode
stops clock operation and halts all code execution. Idle
mode halts the CPU and code execution, but allows
peripheral modules to continue operation. Deep Sleep
mode stops clock operation, code execution and all
peripherals, except RTCC and DSWDT. It also freezes
I/O states and removes power to Flash memory and
may remove power to SRAM.
The assembly syntax of the PWRSAV instruction is shown
in 
. Sleep and Idle modes are entered
directly with a single assembler command. Deep Sleep
requires an additional sequence to unlock and enable
the entry into Deep Sleep, which is described in
Sleep and Idle modes can be exited as a result of an
enabled interrupt, WDT time-out or a device Reset.
When the device exits these modes, it is said to
“wake-up”.
The features enabled with the low-voltage/retention
regulator results in some changes to the way that Sleep
mode behaves. See 
10.1.1.1
Interrupts Coincident with Power 
Save Instructions
Any interrupt that coincides with the execution of a
PWRSAV
 instruction will be held off until entry into
Sleep/Deep Sleep or Idle mode has completed. The
device will then wake-up from Sleep/Deep Sleep or Idle
mode.
EXAMPLE 10-1:
PWRSAV
 INSTRUCTION SYNTAX
Mode
Exit Conditions
Code 
Execution 
Resumes
)
Interrupts
Resets
RTCC 
Alarm
WDT
V
DD
Restore
All
INT0
All POR
MCLR
Idle
Y
Y
Y
Y
Y
Y
Y
N/A
Next instruction
Sleep (all modes)
Y
Y
Y
Y
Y
Y
Y
N/A
Deep Sleep 
N
Y
N
Y
Y
Y
Y
(
N/A
Reset vector
V
BAT
N
N
N
N
N
N
N
Y
Reset vector
Note 1:
Deep Sleep WDT.
2:
Code execution resumption is also valid for all the exit conditions; for example, a MCLR and POR exit will 
cause code execution from the Reset vector.
Note:
SLEEP_MODE
 and IDLE_MODE are
constants defined in the assembler
include file for the selected device.
To enter Deep Sleep, the DSCON<0> bit
should be cleared before setting the
DSEN bit,
// Syntax to enter Sleep mode:
PWRSAV
#SLEEP_MODE
; Put the device into SLEEP mode
//
//Synatx to enter Idle mode:
PWRSAV
#IDLE_MODE
; Put the device into IDLE mode
//
// Syntax to enter Deep Sleep mode:
CLR
DSCON
CLR
DSCON
; (repeat the command)
BSET
DSCON,
#DSEN
; Enable Deep Sleep
BSET
DSCON,
#DSEN
; Enable Deep Sleep (repeat the command)
PWRSAV
#SLEEP_MODE
; Put the device into Deep SLEEP mode