Let's
have a look at how to set each related register and
bit when entering the Stop Mode.
- Setting an Interrupt for Leaving Stop Mode
- Set an interrupt, which is used to place the MCU out of the
Stop Mode. Make sure the priority level set for this interrupt
is higher than the Processor Interrupt Priority Level (IPL).
- Enabling the Interrupt Enable Flag (I Flag)
- Set the Interrupt Enable Flag (I Flag) in the Flag Register
(FLG) to 1 in order to enable all maskable interrupts.
- Removing Protection
- Set the bit for enabling writes to System Clock Control Registers
0 and 1 that is assigned in the Protect Register (address 0000A
)
to 1 in order to remove protection from these two registers.
- Setting the System Clock Control Registers 0 and 1
- Set the operating clock to be used after returning from the Stop Mode. The contents to be set in these
registers differ depending on whether the microcomputer is operated
with the Main Clock or Sub Clock after returning from the Stop
Mode.
- Turning All Clocks Off
- Set the All Clock Stop Control Bit in the system clock control
register 1 to 1 in order to turn all clocks stop. This places
the MCU into the Stop Mode. The MCU is placed out of the Stop
Mode by an interrupt or a hardware reset.
|