![](http://datasheet.mmic.net.cn/120000/R5F21388SDFP_datasheet_3573603/R5F21388SDFP_291.png)
R8C/38T-A Group
16. Timer RB2
Under development Preliminary document
Specifications in this document are tentative and subject to change.
R01UH0241EJ0010 Rev.0.10
Page 260 of 730
Aug 05, 2011
16.4.2
Programmable Waveform Generation Mode
In the 8-bit timer with 8-bit prescaler, registers TRBPR and TRBSC are switched alternately each time the timer
RB2 counter underflows.
In the 16-bit timer, the primary and secondary periods are switched alternately each time the 16-bit counter
underflows. The 16-bit counter for the primary period consists of the higher 8 bits in the TRBPR register and
the lower 8 bits in the TRBPRE register. The 16-bit counter for the secondary period consists of the higher 8
bits in the TRBSC register and the lower 8 bits in the TRBPRE register.
The TRBO pin outputs an inverted waveform each time the counter underflows. The count is started from the
primary period. In programmable waveform generation mode, the TRBOCR register is not used.
When 1 (count starts) is written to the TSTART bit in the TRBCR register, the count is started. When 0 (count
stops) is written to the TSTART bit, the count is stopped. When 1 (count is forcibly stopped) is written to the
TSTOP bit in the TRBCR register, the count is stopped.
An interrupt request is generated when the timer RB2 counter underflows during the secondary period.
When registers TRBPRE and TRBPR are read, each count value can be read. When registers TRBPRE,
TRBPR, and TRBSC are written while the count is stopped, values are written to both the reload register and
counter, respectively. When these registers are written during count operation, values are written to the reload
register and then transferred to the counter at the next reload operation.
Note:
1. The count is started after three cycles of the count source when the TSTART bit is set to 1 (count starts).
The count is stopped after three cycles of the count source when the TSTART bit is set to 0 (count stops).
Monitor the TCSTF bit in the TRBCR register to confirm the operating state of the counter.