
R8C/36T-A Group
16. Timer RB2
Under development Preliminary document
Specifications in this document are tentative and subject to change.
R01UH0240EJ0010 Rev.0.10
Page 274 of 728
Aug 05, 2011
16.8
Notes on Timer RB2
(1) Timer RB2 stops counting after a reset. Start the count after setting the values in the timer and prescaler.
(2) In the 16-bit timer, when accessing registers TRBPRE and TRBPR in 8-bit units (8-bit access), always access
the lower byte (TRBPRE) first and then the higher byte (TRBPR).
(3) In programmable one-shot and programmable wait one-shot generation modes, when the TOSSP bit in the
TRBOCR register is set to 1 (one-shot stops) and the count is stopped, the timer reloads the value of the reload
register and stops. To check how much the count value has changed when the timer stopped, read the timer
value before the timer stops. When the TSTART bit in the TRBCR register is set to 0 (count stops) and the
count is stopped, the timer stops and the value of the reload register is not reloaded.
(4) After 1 (count starts) is written to the TSTART bit while the count is stopped, the TCSTF bit in the TRBCR
register remains 0 (count stops) for two or three cycles of the count source. Do not access the registers
associated with timer RB2 (1) other than the TCSTF bit until this bit is set to 1 (count in progress). The count
is started at the first active edge of the counter source after the TCSTF bit is set to 1.
After 0 (count stops) is written to the TSTART bit during count operation, the TCSTF bit remains 1 for two or
three cycles of the count source. When the TCSTF bit is set to 0, the count is stopped. Do not access the
registers associated with timer RB2 (1) other than the TCSTF bit until this bit is set to 0.
Note:
1. Registers associated with timer RB2:
TRBCR, TRBOCR, TRBIOC, TRBMR, TRBPRE, TRBPR, and TRBSC
(5) When the TSTART bit is 0 (count stops), wait for at least two cycles of the CPU clock and then set the
TSTART bit to 1 (count starts) to change the values of registers TRBPRE, TRBPR, and TRBSC.
(6) When the TSTART bit is 1 (count starts) or the TCSTF bit is 1 (count in progress), do not change the values of
registers TRBIOC and TRBMR, and the TRBIE bit in the TRBIR register.
(7) If 1 (count is forcibly stopped) is written to the TSTOP bit in the TRBCR register during operation, timer RB2
stops without any wait time.
(8) If 1 (one-shot starts) is written to the TOSST bit in the TRBOCR register or 1 (one-shot stops) is written to the
TOSSP bit, the TOSSTF bit changes after two to three cycles of the count source. If 1 is written to the TOSSP
bit during the period after 1 is written to the TOSST bit but before the TOSSTF bit can become 1 (one-shot is
operating (including wait period)), depending on the internal state the TOSSTF bit may become 0 (one-shot is
stopped) or 1. Similarly, if 1 is written to the TOSST bit during the period after 1 is written to the TOSSP bit
but before the TOSSTF bit can become 0, the TOSSTF bit may become 0 or 1.
(9) When the underflow signal from timer RJ is used as the count source for timer RB2, set timer RJ to timer
mode, pulse output mode, or event counter mode.
(10) Make sure the TCSTF bit is 1 (count in progress) before writing 1 (one-shot count starts) to the TOSST bit in
the TRBOCR register. When the TCSTF bit is 0 (count stops), writing 1 (one-shot count starts) to the TOSST
bit has no effect.
(11) In programmable waveform and programmable wait one-shot generation modes of timer RB2, write to the
TRBSC register before writing to the TRBPR register. The value of the TRBPR register is reflected to the
counter during the underflow of the secondary period after the TRBPR register is written. If registers TRBSC
and TRBPR are written multiple times during the period after the TRBPR register was written but before the
secondary period underflow, the data that was written last will be reflected in the counter. However, do not
write to the TRBSC register only on its own. Write to both the TRBSC and TRBPR registers.
(12) Insert NOP instructions between writing to and reading from registers TRBPRE and TRBPR while the counter
is stopped.