159
CHAPTER 8 LOW-POWER CONSUMPTION MODE
The devices does not guarantee its operation after returning from the standby mode if you place an array
of instructions other than the one enclosed in the line.
●
To access the low-power consumption mode control register (LPMCR) with C language
To enter the standby mode using the low-power consumption mode control register (LPMCR), use one
of the following methods 1. to 3. to access the register:
1. Specify the standby mode transition instruction as a function and insert two __wait_nop() built-in
functions after that instruction. If any interrupt other than the interrupt to return from the standby mode
can occur within the function, optimize the function during compilation to suppress the LINK and
UNLINK instructions from occurring.
Example: Watch mode or timebase timer mode transition function
2. Define the standby mode transition instruction using __asm statements and insert two NOP and JMP
instructions after that instruction.
Example: Transition to sleep mode
3. Define the standby mode transition instruction between #pragma asm and #pragma endasm and insert
two NOP and JMP instructions after that instruction.
Example: Transition to stop mode
void enter_watch(){
IO_LPMCR.byte = 0x10; /* Set LPMCR TMD bit to 0 */
__wait_nop();
__wait_nop();
}
__asm("MOV I:_IO_LPMCR, #H’ 58); /* Set LPMCR SLP bit to 1 */
__asm("NOP");
__asm("OP");
__asm("JMP $+3"); /* Jump to the next instruction*/
#pragma asm
MOV I:_IO_LPMCR, #H’ 98 /* Set LPMCR STP bit to 1 */
NOP
NOP
JMP $+3 /* Jump to the next instruction */
#pragma endasm