Timer X
Mitsubishi microcomputers
M30201 Group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
236
In pulse period/pulse width measurement mode, choose functions from those listed in Table 2.4.7. Op-
erations of the circled items are described below. Figure 2.4.16 shows the operation timing, and Figure
2.4.17 shows the set-up procedure.
2.4.8 Operation of Timer X (pulse period measurement mode)
Figure 2.4.16. Operation timing of pulse period measurement mode
Table 2.4.7. Choosed functions
Operation
Note
(1) Setting the count start flag to “1” causes the counter to start counting the count source.
(2) If a measurement pulse changes from “H” to “L”, the value of the counter goes to “000016”,
and measurement is started. In this instance, an indeterminate value is transferred to the
reload register. The timer Xi interrupt request does not generate.
(3) If a measurement pulse changes from “H” to “L” again, the value of the counter is transferred
to the reload register, and the timer Xi interrupt request bit goes to “1”. Then the value of the
counter becomes “000016”, and the measurement is started again.
The timer Xi interrupt request bit goes to “1” when an effective edge of a measurement pulse is
input or timer Xi is overflowed. The factor of interrupt request can be determined by use of the
timer Xi overflow flag within the interrupt routine.
The value of the counter at the beginning of a count is indeterminate. Thus there can be in-
stances in which the timer Xi overflow flag goes to “1” immediately after a count is performed.
The timer Xi overflow flag goes to “0” if timer Xi mode register is written to when the count start
flag is “1”. This flag cannot be set to “1” by software.
Item
Set-up
Count source
Internal count source (f1 / f8 / f32 / fc32)
Pulse width measurement (interval between measurement pulse falling edge to rising edge,
and between rising edge to falling edge)
O
Pulse period measurement (interval between measurement pulse falling edge to falling edge)
Pulse period measurement (interval between measurement pulse rising edge to rising edge)
O
Measurement
mode
Count source
Measurement pulse
Count start flag
Timer Xi interrupt
request bit
Timing at which counter
reaches “000016”
“1”
“H”
“1”
Transfer
(indeterminate value)
Reload register
← counter
transfer timing
“L”
“0”
Timer Xi overflow flag
“1”
“0”
Note 1: Counter is initialized at completion of measurement.
Note 2: Timer has overflowed.
Measurement of pulse time interval from falling edge to falling edge
Transfer
(measured value)
Cleared to “0” when interrupt request is accepted, or cleared by software
(1) Start count
(2) Start measurement
(3) Start measurement again
(Note 1)
(Note 2)