English
Language : 

M38203M4 Datasheet, PDF (165/344 Pages) Mitsubishi Electric Semiconductor – 8-BIT SINGLE-CHIP MICROCOMPUTER
APPLICATION
2.3 Timer X and timer Y
RESET
Initialization
CLT
CLD
SEI
All interrupts; Disabled
ICON1 (Address 3E16) ← XXX0XXXX2
ICON2 (Address 3F16) ← 0XXXXXX02
P5D (Address 0B16), bit 4← 0
TXM (Address 2716) ← 1011XXXX2
TXL (Address 2016)
← A716
TXH (Address 2116)
← 6116 (25000 – 1)
Timer X interrupt; Disabled
CNTR0 interrupt; Disabled
Set P54/CNTR0 pin for input mode
Connect timer X
Set “division ratio – 1” to timer X (low-order) and timer X (high-order)
(Set values in the order of low-order byte and high-order byte)
TXM (Address 2716), bit 7← 0
Timer count start
ICON1 (Address 3E16) ← XXX1XXXX2
ICON2 (Address 3F16) ← 0XXXXXX12
Timer X interrupt; Enabled
CNTR0 interrupt; Enabled
CLI
Interrupts; Enabled
CNTR0 interrupt occurs at
transition from “H” to “L” of
waveform which is input to
P54/CNTR0 pin
CNTR0 interrupt processing routine
The number of
N
underflows is within
the range ?
Y
Timer X value is within N
the range ?
Y
Judged as presence of ringing
pulse (Set ringer flag)
Check the number of underflows
counted by timer X interrupt
→ If the number is 4 or less and 24
or more, the pulse is abnormal
Check pulse width
→ When pulse width is within
range, the pulse is normal
Timer X interrupt occurs
at timer X underflow
(at every 50 ms)
N
A ringing pulse exists ?
(Ringer flag = “H”)
Y
Processing when a
ringing pulse exists
TXL (Address 2016)← A716
TXH (Address 2116)← 6116
(25000 – 1)
RTI
Reload to timer X register
Timer X interrupt processing routine
Count the number of
underflows
RTI
If 24 underflows or more are
counted, regard the ringing pulse
as out of standard, and execute
error processing
Fig. 2.3.40 Control procedure
3820 GROUP USER’S MANUAL
2–79