R01UH0092EJ0110 Rev.1.10
Page 320 of 807
Jul 31, 2012
M16C/64C Group
18. Timer B
18.3.4
Pulse Period/Pulse Width Measurement Modes
In pulse period and pulse width measurement modes, the timer measures the pulse period or pulse
width of an external signal. Table 18.9 lists Specifications of Pulse Period/Pulse Width Measurement
Modes, Table 18.10 lists Registers and Settings in Pulse Period/Pulse Width Measurement Modes,
Figure 18.6 shows Operation Example in Pulse Period Measurement Mode, and Figure 18.7 shows an
Operation Example in Pulse Width Measurement Mode.
Table 18.9
Specifications of Pulse Period/Pulse Width Measurement Modes
Item
Specification
Count sources
f1TIMAB, f2TIMAB, f8TIMAB, f32TIMAB, f64TIMAB, fOCO-S, fC32
Count operations
•
Increment
•
The counter value is transferred to the reload register at an active edge of the
measurement pulse. The counter value becomes 0000h and count continues.
Count start condition
Set the TBiS bit to 1 (start counting).
Count stop condition
Set the TBiS bit to 0 (stop counting).
Interrupt request
generation timing
•
When an active edge of measurement pulse is input
(1)
•
Timer overflow. The MR3 bit in the TBiMR register becomes 1 (overflowed) at
the same time an overflow occurs.
TBiIN pin function
Measurement pulse input
Read from timer
When bits PPWFS12 to PPWFS10 and PPWFS22 to PPWFS20 in registers
PPWFS1 and PPWFS2 are 0
•
Value of the reload register (measurement result) can be read by reading the
TBi register.
(2)
When bits PPWFS12 to PPWFS10 and PPWFS22 to PPWFS20 in registers
PPWFS1 and PPWFS2 register are 1
•
Value of the counter (counter value) can be read by reading the TBi register.
•
Value of the reload register (measurement result) can be read by reading the
TBi1 register.
Write to timer
When not counting, the value written to the TBi register is written to both the
reload register and counter.
i = 0 to 5
TBiS: Bit in the TABSR or TBSR register
Notes:
1.
No interrupt request is generated when the first active edge is input after the timer starts
counting.
2.
The value read from the TBi register is undefined until the second active edge is input after the
timer starts counting.
3.
When timer Bi in pulse-period measurement mode or pulse-width measurement mode is used
as an event or trigger for timer A or timer B other than timer Bi, an event or trigger occurs at both
the overflow and active edge of the measurement pulse.
Summary of Contents for M16C Series
Page 846: ...M16C 64C Group R01UH0092EJ0110...