R8C/20 Group, R8C/21 Group 14. Timers
Rev.2.00 Aug 27, 2008 Page 130 of 458
REJ09B0250-0200
14.1.4 Pulse Width Measurement Mode
Pulse width measurement mode is mode to measure the pulse width of an external signal which inputs from the
INT1
/TRAIO pin (see Table 14.5 Pulse Width Measurement Mode Specifications).
Figure 14.9 shows the TRAIOC Register in Pulse Width Measurement Mode and Figure 14.10 shows the
Operating Example of Pulse Width Measurement Mode.
Table 14.5 Pulse Width Measurement Mode Specifications
Item Specification
Count Sources f1, f2, f8, fOCO
Count Operations • Decrement
• Continuously counts the selected signal only when measurement pulse is “H”
level, or conversely only “L” level.
• When the timer underflows, the contents in the reload register is reloaded
and the count is inherited
Count Start Condition Write 1 (count starts) to the TSTART bit in the TRACR register
Count Stop Conditions • Write 0 (count stops) to the TSTART bit in the TRACR register
• Write 1 (count forcibly stops) to the TSTOP bit in the TRACR register
Interrupt Request
Generation Timing
• When timer RA underflows [timer RA interrupt]
• Rising or falling of the TRAIO input (end of measurement period) [timer RA
interrupt]
INT1
/TRAIO Pin
Function
Measurement pulse input (INT1 interrupt input)
TRAO Pin Function
Programmable I/O port
Read from Timer The count value can be read by reading the TRA and TRAPRE registers.
Write to Timer • When registers TRAPRE and TRA are written while the count is stopped,
values are written to both the reload register and counter.
• When registers TRAPRE and TRA are written during the count, values are
written to the reload register and counter (refer to 14.1.1.1 Timer Write
Control during Count Operation).
Select Functions
• Measurement level select
The TEDGSEL bit in the TRAIOC register can select during “H” or “L” level
• Measurement pulse input pin select function
P1_7 or P1_5 is selected by the TIOSEL bit in the TRAIOC register.
• Digital filter function
Bits TIPF0 and TIPF1 in the TRAIOC register enable or disable the digital
filter and select the sampling frequency.