223
CHAPTER 7 STANDBY FUNCTION
<Sample program>
(Initialization)
MOV A,#0011B
MOV PCC,A ; High-speed mode
MOV XA,#05
MOV WM,XA ; Subsystem clock
EI IE4
EI IEW
EI ; Enable interrupt
(Main routine)
SKT PORT0.0 ; Power normal?
HALT ; Power-down mode
NOP ; Power normal?
SKTCLR IRQW ; Flag set for 0.5 second?
BR MAIN ; NO
CALL WATCH ; Clock subroutine
MAIN: .
.
.
.
.
.
.
.
.
.
(INT4 service routine)
VINT4: SKT PORT0.0 ; Power normal? MBE = 0
BR PDOWN
CLR1 SCC.3 ; Start main system clock oscillation
MOV A,#8
MOV BTM,A
WAIT1: SKT IRQBT ; Wait for 250 ms
BR WAIT1
SKT PORT0.0 ; Chattering check
BR PDOWN
CLR1 SCC.0 ; Switch to main system clock
RETI
PDOWN: SET1 SCC.0 ; Switch to subsystem clock
MOV A,#6
WAIT2: INCS A ; Wait for 32 machine cycles
BR WAIT2
SET1 SCC.3 ; Stop main system clock oscillation
RETI
Caution Before the system clock is changed from the main system clock to the subsystem clock,
a wait time sufficient for stable subsystem clock generation is required.