English
Language : 

M38203M4 Datasheet, PDF (186/344 Pages) Mitsubishi Electric Semiconductor – 8-BIT SINGLE-CHIP MICROCOMPUTER
APPLICATION
2.4 Timer 1, timer 2, and timer 3
2.4.4 Application example
Timer mode: Clock function (measurement of one second)
Outline: The input clock is divided by timer, with a timer 1 interrupt caused every 0.4 ms, 1 second is
counted. Thus, the clock is counted up every second.
Specification: •Division of f(XCIN) = 32 kHz by timer 1 causes an interrupt.
•The counter value counted by the timer 1 interrupt is checked in the main routine. If 1
second has elapsed, the clock counts up.
Figure 2.4.14 shows the setting of the related registers and Figure 2.4.15 shows the control procedure.
b7
b0
1 X X X X X T123M : Timer 123 mode register [Address 2916]
b5 : Timer 1 count source selection bit
1 : f(XCIN)
: Noting is allocated
7F16
T1 : Timer 1 [Address 2416]
Set “division ratio – 1 (127 : 7F16) ” in the timer 1
Notes 1 : 1 second = 1/32 kHz ! (127 + 1) ! 250
Division ratio Counted in interrupt
2 : Write values in the order of the timer 1,
processing
timer 2, and timer 3.
b7
b0
0 X X X X 1 X X ICON2 : Interrupt control register 2 [Address 3F16]
b2 : Timer 1 interrupt enable bit
1 : Interrupt enabled
Fig. 2.4.14 Setting of related registers
2–100
3820 GROUP USER’S MANUAL