2.3 Timer X and timer Y
APPLICATION
2–77
3820 GROUP USER’S MANUAL
(2) Pulse width measurement mode: Ringer signal detection
Outline :
A telephone ringing pulse
8
is detected by applying the timer X interrupt and the pulse width
measurement mode.
Specifications :
Whether a telephone call exists or not is judged by measuring a pulse width output
from the “H” active ringing pulse detection circuit.
f(X
IN
) = 8 MHz is used as the count source.
When the following condition is satisfied, it is regard as normal.
200 ms
≤
pulse width of a ringing pulse
<
1.2 s
Figure 2.3.36 shows an example of a peripheral circuit, Figure 2.3.37, the setting of the related
registers, Figure 2.3.38, a ringing pulse waveform, Figure 2.3.39, an operation timing when a ringing
pulse is input, and Figure 2.3.40, the control procedure.
Fig. 2.3.36 Example of peripheral circuit
Fig. 2.3.37 Setting of related registers
3820 group
CNTR
0
Ringing pulse
detection
circuit
Telephone circuit
8
Ringing pulse : Signal which is sent by turning on/off (make/break) the telephone line.
Each country has a different standard. In this case, Japanese domestic
standard is adopted as an example.
TXM : Timer X mode register [Address 27
16
]
b5, b4 : Timer X operating mode bits
1 1 : Pulse width measurement mode
b6 : CNTR
0
active edge switch bit
0 : Pulse width measurement mode (Measure “H” level width)
CNTR
0
interrupt (Falling edge active)
b7 : Timer X stop control bit
1 : Count stop
P5D : Port P5 direction register [Address 0B
16
]
b4 : Bit corresponding to port P5
4
0 : Input mode
b7
X
b0
X
0
b7
1
b0
X
1
1
TXL : Timer X (low-order) [Address 20
16
]
TXH : Timer X (high-order) [Address 21
16
]
A7
16
61
16
Set “division ratio – 1 (24999 : 61A7
16
) ” in the timer X register
ICON1 : Interrupt control register 1 [Address 3E
16
]
b4 : Timer X interrupt enable bit
1 : Interrupt enabled
b7
X
b0
X
1
X
X
X
X
X
X
X
X
0
X
X
X
X
X
ICON2 : Interrupt control register 2 [Address 3F
16
]
b0 : CNTR
0
interrupt enable bit
1 : Interrupt enabled
0
b7
b0
1
X
X
X
X
X
X
Note :
Write values in the order of
the low-order byte and the
high-order byte.