English
Language : 

M38002M4 Datasheet, PDF (62/173 Pages) Mitsubishi Electric Semiconductor – 8-BIT SINGLE-CHIP MICROCOMPUTER
APPLICATION
2.2 Timer
Control procedure :
Figure 2.2.12 shows a control procedure.
RESET
Initialization
SEI
TM (Address : 2316)
XXXX1X002
ICON1 (Address : 3E16), bit4 1
PREX (Address : 2416)
TX (Address : 2516)
256 – 1
256 – 1
TM (Address : 2316), bit3 0
CLI
q X : This bit is not used in this application.
Set it to “0” or “1.” It’s value can be disregarded.
q All interrupts : Disabled
q Timer X : Timer mode
q Timer X interrupt : Enabled
q Set “division ratio – 1” to the Prescaler X
and Timer X.
q Timer X count : Operating
q Interrupts : Enabled
Main processing
[Processing for completion of setting clock]
(Note 1)
PREX (Address : 2416)
TX (Address : 2516)
IREQ1 (Address : 3C16), bit4
256 – 1
256 – 1
0
q When restarting the clock from zero
second after completing to set the
clock, re-set timers.
Note 1: This processing is performed only
at completing to set the clock.
Timer X interrupt processing routine
CLT (Note 2)
CLD (Note 3)
Push register to stack
Y
Clock stop?
N
Clock count up (1/4 second-year)
Note 2: When using the Index X mode flag (T).
Note 3: When using the Decimal mode flag (D).
q Push the register used in the interrupt
processing routine into the stack.
q Check if the clock has already been set.
q Count up the clock.
Pop registers
RTI
q Pop registers which is pushed to stack
Fig. 2.2.12 Control procedure [Clock function]
2-14
3800 GROUP USER’S MANUAL