English
Language : 

M38002M4 Datasheet, PDF (67/173 Pages) Mitsubishi Electric Semiconductor – 8-BIT SINGLE-CHIP MICROCOMPUTER
Control procedure :
Figure 2.2.19 shows a control procedure.
APPLICATION
2.2 Timer
RESET
Initialization
SEI
TM (Address : 2316)
1110XXXX2
PRE12 (Address : 2016)
64–1
T1 (Address : 2116)
8–1
PREY (Address : 2616)
1–1
TY (Address : 2716)
256–1
ICON1 (Address : 3E16), bit6 1
TM (Address : 2316), bit7 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 Y : Event counter mode
(Count at falling edge of pulse input from CNTR1 pin)
q Set the division ratio so that the Timer 1 interrupt
occurs every 2 ms.
q Timer 1 interrupt : Enabled
q Timer Y count : Start
q Interrupts : Enabled
Timer 1 interrupt processing routine
CLT (Note 1)
CLD (Note 2)
Push register to stack
1
IREQ1 (Address : 3C 16), bit5?
0
(A)
TY (Address : 27 16)
Note 1: When using the Index X mode flag (T).
Note 2: When using the Decimal mode flag (D).
q Push the register used in the interrupt
processing routine into the stack.
q When the count value is 256 or more, the
processing is performed as out of range.
q Read the count value.
q Store the count value in the accumulator (A).
214 < (A) < 228?
Out of range
Fpulse 0
In range
q Compare the count value read with the
reference value.
q Store the comparison result in flag Fpulse.
Fpulse 1
TY (Address : 2716)
IREQ1 (Address : 3C 16), bit5
256 – 1
0
q Initialize the count value.
q Set the Timer Y interrupt request bit to “0.”
Processing for a result of judgment
Pop registers
q Pop registers which is pushed to stack.
RTI
Fig. 2.2.19 Control procedure [Measurement of frequency]
3800 GROUP USER’S MANUAL
2-19