M30245 Group
2.16.2 Stop Mode Set-Up
Settings and operation for entering stop mode are described here.
Operation
(1) Enables the interrupt used for returning from stop mode.
(2) Sets the interrupt enable flag (I flag) to "1".
(3) Clearing the protection and setting all clock stop control bit to "1" stops oscillation and causes
the processor to go into stop mode.
( 1 ) S e t t i n g i n t e r r u p t t o c a n c e l s t o p m o d e
b 7
D i s a b l e t h e i n t e r r u p t n o t t o b e u s e d f o r c a n c e l l i n g s t o p m o d e .
( 2 ) I n t e r r u p t e n a b l e f l a g ( I f l a g )
( 3 ) C a n c e l i n g p r o t e c t
b 7
( 3 ) S e t t i n g o p e r a t i o n c l o c k a f t e r r e t u r n i n g f r o m s t o p m o d e
( W h e n o p e r a t i n g w i t h X
b 7
0
0
A s t h i s r e g i s t e r b e c o m e s s e t t i n g m e n t i o n e d a b o v e w h e n
o p e r a t i n g w i t h X
I N
t h e u s e r d o e s n o t n e e d t o s e t i t a g a i n .
W h e n o p e r a t i n g w i t h X
t o " 0 " b e f o r e s e t t i n g s y s t e m c l o c k s e l e c t b i t t o " 0 " . T h e b o t h
b i t s c a n n o t b e s e t a t t h e s a m e t i m e .
( 3 ) A l l c l o c k s o f f ( s t o p m o d e )
b 7
0 0 0 0
I n s e r t a t l e a s t f o u r N O P s f o l l o w i n g J M P . B i n s t r u c t i o n a f t e r t h e i n s t r u c t i o n t h a t s e t s t h e a l l c l o c k s t o p c o n t r o l b i t t o " 1 " .
Figure 2.16.5. Example of stop mode set-up
Rev.2.00 Oct 16, 2006
REJ09B0340-0200
I n t e r r u p t c o n t r o l r e g i s t e r
K U P I C
[ A d d r e s s 0 0 4 1
]
1 6
S i R I C ( i = 0 , 2 , 3 )
[ A d d r e s s 0 0 4 A
, 0 0 4 2
, 0 0 5 5
1 6
1 6
S 1 3 B C N I C
[ A d d r e s s 0 0 4 3
]
1 6
T A i I C ( i = 0 t o 4 )
[ A d d r e s s 0 0 5 4
, 0 0 4 5
, 0 0 4 7
1 6
1 6
S i T I C ( i = 0 t o 3 )
[ A d d r e s s 0 0 5 3
, 0 0 5 1
, 0 0 4 F
1 6
1 6
R S M I C
[ A d d r e s s 0 0 5 8
]
1 6
V B D I C
[ A d d r e s s 0 0 5 C
]
1 6
b 0
I n t e r r u p t p r i o r i t y l e v e l s e l e c t b i t
M a k e s u r e t h a t t h e i n t e r r u p t p r i o r i t y
l e v e l o f t h e i n t e r r u p t w h i c h i s u s e d t o
c a n c e l t h e w a i t m o d e i s h i g h e r t h a n
t h e p r o c e s s o r i n t e r r u p t p r i o r i t y ( I P L ) o f
t h e r o u t i n e w h e r e t h e W A I T
i n s t r u c t i o n i s e x e c u t e d .
" 1 "
b 0
P r o t e c t r e g i s t e r [ A d d r e s s 0 0 0 A
0
1
P R C R
E n a b l e s w r i t i n g t o s y s t e m c l o c k c o n t r o l r e g i s t e r s 0 a n d 1 ( a d d r e s s e s 0 0 0 6
f r e q u e n c y s y n t h e s i z e r r e g i s t e r s ( a d d r e s s e s 0 3 D B
1 : W r i t e - e n a b l e d
R e s e r v e d b i t
M u s t a l w a y s b e s e t t o " 0 "
a f t e r r e t u r n i n g )
I N
S y s t e m c l o c k c o n t r o l r e g i s t e r 0
b 0
0 0
[ A d d r e s s 0 0 0 6
] C M 0
1 6
R e s e r v e d b i t
M u s t a l w a y s b e s e t t o " 0 "
M a i n c l o c k ( X
- X
) s t o p b i t
I N
O U T
O n
S y s t e m c l o c k s e l e c t b i t
X
, X
I N
O U T
( c o u n t s o u r c e o f B C L K i s X
) ,
I N
, s e t m a i n c l o c k ( X
- X
) s t o p b i t
C I N
I N
O U T
b 0
S y s t e m c l o c k c o n t r o l r e g i s t e r [ A d d r e s s 0 0 0 7
1
C M 1
A l l c l o c k s t o p c o n t r o l b i t
1 : A l l c l o c k s o f f ( s t o p m o d e )
R e s e r v e d b i t
M u s t a l w a y s b e s e t t o " 0 "
A l l c l o c k s o f f ( s t o p m o d e )
page 280 of 354
]
1 6
, 0 0 5 7
, 0 0 5 9
]
1 6
1 6
1 6
, 0 0 4 D
]
1 6
1 6
I N T i I C ( i = 0 t o 2 )
b 7
b 0
S 1 R I C
0
S 0 2 B C N I C
I n t e r r u p t p r i o r i t y l e v e l s e l e c t b i t
M a k e s u r e t h a t t h e i n t e r r u p t p r i o r i t y l e v e l o f t h e
i n t e r r u p t w h i c h i s u s e d t o c a n c e l t h e w a i t m o d e i s
h i g h e r t h a n t h e p r o c e s s o r i n t e r r u p t p r i o r i t y ( I P L ) o f
t h e r o u t i n e w h e r e t h e W A I T i n s t r u c t i o n i s e x e c u t e d .
R e s e r v e d b i t
M u s t a l w a y s b e s e t t o " 0 "
]
1 6
1 6
t o 0 3 D F
)
1 6
1 6
( W h e n o p e r a t i n g w i t h X
C I N
b 7
b 0
S y s t e m c l o c k c o n t r o l r e g i s t e r 0
1
0 0
1
[ A d d r e s s 0 0 0 6
R e s e r v e d b i t
M u s t a l w a y s b e s e t t o " 0 "
P o r t X
C
X
- X
C I N
S y s t e m c l o c k s e l e c t b i t
X
, X
C I N
A s t h i s r e g i s t e r b e c o m e s s e t t i n g m e n t i o n e d a b o v e w h e n o p e r a t i n g w i t h X
( c o u n t s o u r c e o f B C L K i s X
) , t h e u s e r d o e s n o t n e e d t o s e t i t a g a i n .
C I N
W h e n o p e r a t i n g w i t h X
, s e t p o r t X c s e l e c t b i t t o " 1 " b e f o r e s e t t i n g s y s t e m c l o c k
I N
s e l e c t b i t t o " 1 " . T h e b o t h b i t s c a n n o t b e s e t a t t h e s a m e t i m e .
]
1 6
[ A d d r e s s 0 0 5 F
, 0 0 4 4
, 0 0 5 E
1 6
1 6
[ A d d r e s s 0 0 4 8
]
1 6
[ A d d r e s s 0 0 4 9
]
1 6
a n d 0 0 0 7
) a n d
1 6
a f t e r r e t u r n i n g )
] C M 0
1 6
s e l e c t b i t
g e n e r a t i o n
C O U T
C O U T
C I N
2. Power Control
]
1 6