AP08056
Power Saving Features
Power Down of the Entire System (Power-Down Mode)
Application Note
13
V1.0, 2006-12
4
Power Down of the Entire System (Power-Down
Mode)
Power-down of the entire system can be achieved by setting the device in power-down
mode. In this mode, all functions of the microcontroller are stopped and only the contents
of the FLASH, on-chip RAM, XRAM and the SFRs are maintained. The port pins hold the
logical state they had when the power-down mode was activated. For the digital ports,
the user should ensure that the ports are not left floating. Floating input port pins should
enable pull-down or set as output. Output pins that are pulled-up should be set to high.
For the analog Port 2, the user should disable the input driver of the port by setting the
port direction to output.
In power-down mode, the clock is turned off. Hence, it cannot be awakened by an
interrupt or by the WDT. It is awakened only when it receives an external wake-up signal
or reset signal.
4.1
Entering Power-Down Mode
Software requests power-down mode by setting the bit PMCON0.PD (protected bit) to 1.
Two NOP instructions must be inserted after the bit PMCON0.PD is set to 1. The device
will not enter power-down mode immediately after executing the instruction to set
PMCON0.PD and therefore the two NOPs is to ensure the first instruction (after two NOP
instructions) is executed correctly after wake-up from power-down mode.
If the external wake-up from power-down is used, software must select the EXINT0 pin,
the RXD pin, or either of these two pins as the wake-up source by selecting the WS bit
of the PMCON0 register. Exit from power-down mode can be achieved when a falling
edge trigger is detected at the selected source(s). Bit MODPISEL.URRIS is used to
select one of the two RXD inputs and bit MODPISEL.EXINT0IS is used to select one of
the two EXINT0 inputs.
The wake-up with reset or without reset is selected by bit
PMCON0.WKSEL. The wake-up source and wake-up type must be selected before the
system enters the power-down mode.
In order for the program to resume its operation from where it was stopped after the
reset, it is necessary to save the contents of the relevant registers to the stack including
the current stack pointer. The example below shows how the power-down mode can be
entered correctly with the port status stored to stack.
//... SP was initialized as 0x41
PORT_PAGE = 0x00;//Open port page 0 to access Px_DATA
_push_(P3_DATA);//Save port 3, current SP = 0x42.
//_push_() function is defined in intrins.h