English
Language : 

M38203M4 Datasheet, PDF (187/344 Pages) Mitsubishi Electric Semiconductor – 8-BIT SINGLE-CHIP MICROCOMPUTER
APPLICATION
2.4 Timer 1, timer 2, and timer 3
RESET
Initialization
CLT
CLD
SEI
All interrupts; Disabled
ICON2 (Address 3F16) ← 0XXXX0XX2
T123M (Address 2916) ← XX1XXXXX2
Timer 1 interrupt; Disabled
Connect timer 1
T1 (Address 2416)
← 7F16 (128 – 1) Set “division ratio – 1” to timer 1
(Set in the order of timer 1, timer 2, and timer 3)
Timer count start
ICON2 (Address 3F16) ← 0XXXX1XX2
CLI
Timer 1 interrupt; Enabled
Interrupts; Enabled
Interrupts every 0.4 ms
Timer 1 interrupt processing routine
Clock stop ?
N
1 second has elapsed ?
(1 second counter = 250 ?)
Y
Check if the clock has
already been set
1 second counter + 1
RTI
N Check a lapse of 1 second
Y
Clear 1 second counter
V
Count up clock
(Second—Year)
Clear the counter counted by interrupt processing
Main processing
Specify so that all processing within the loop markedV
is repeated in a cycle of 1 second or less
<Processing for completion of setting clock >
(Note)
T1 (Address 2416)
← 7F16
IREQ2 (Address 3D16), bit 2 ← 0
1 second counter
←0
When restarting the clock from zero second after
completing to set the clock, set timers again.
Note : This processing is performed only
at completing to set the clock
Fig. 2.4.15 Control procedure
3820 GROUP USER’S MANUAL
2–101