
APPLICATION
2.3 Timer X and timer Y
3820 GROUP USER’S MANUAL
2–44
(2) Period measurement mode
In the period measurement mode, the period of a pulse input from the P5
5
/CNTR
1
pin is measured.
Operation in the period measurement mode is described below.
x
Start of count operation
Immediately after reset release, the timer Y stop control bit is in the “0” state. For this reason, the
count operation is automatically started after reset release.
The value of the Y counter is decremented by 1 each time a count source is input.
The count source is f(X
IN
)/16 clock (low-speed mode ; f(X
CIN
)/16 clock).
Reload operation
At the edge of the pulse input from the P5
5
/CNTR
1
pin, the value of the Y latch is transferred
(reloaded) to the Y counter. The count value immediately before reload is held until it is read out
once after reload.
As an active edge, the falling edge ( ) or rising edge ( ) is specified by the CNTR
1
active edge
switch bit.
The value of the Y latch is also reloaded at the Y counter underflow.
Period measurement
As a period measurement duration, the following is selected by the CNTR
1
active edge switch
bit (bit 6) : Duration from the falling edge to the falling edge (bit 6 = “0”)
Duration from the rising edge to the rising edge (bit 6 = “1”)
The difference between the count value at an active edge input and that immediately before reload
is a measured period.
Interrupt operation
I
Edge of input pulse
At the edge of the pulse input from the P5
5
/CNTR
1
pin, an interrupt request occurs. At the same
time, the CNTR
1
interrupt request bit is set to “1.” The occurrence of an interrupt is controlled by
the CNTR
1
interrupt enable bit.
As an active edge, the falling edge (
) or rising edge ( ) is specified by the CNTR
1
active edge
switch bit.
I
Counter underflow
An interrupt request occurs at the Y counter underflow. At the same time, the timer Y interrupt
request bit is set to “1.”
The occurrence of an interrupt is controlled by the timer Y interrupt enable bit.
Figure 2.3.7 shows a period measurement mode operation example.