![](http://datasheet.mmic.net.cn/120000/R5F21388SDFP_datasheet_3573603/R5F21388SDFP_294.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 263 of 730
Aug 05, 2011
16.4.3
Programmable One-Shot Generation Mode
In this mode, a one-shot pulse is output from the TRBO pin by a program, external trigger input (INT0), or the
rising edge of event input from the event link controller (ELC). An arbitrary period from the trigger is counted.
In the 8-bit timer with 8-bit prescaler, the count value is set in the TRBPR register.
In the 16-bit timer, the count value of the higher 8 bits is set in the TRBPR register and that of the lower 8 bits
is set in the TRBPRE register.
One-shot operation is achieved by starting the timer RB2 count when the trigger is accepted, and by stopping
the count operation when the timer RB2 counter underflows. When the trigger is accepted once, one-shot
operation is performed once. In programmable one-shot generation mode, the TRBSC register is not used.
When 1 (one-shot count starts) is written to the TOSST bit in the TRBOCR register while the TCSTF bit in the
TRBCR register is 1 (count enabled), the count is started. If a valid trigger is input to the INT0 pin while the
TCSTF bit is 1, the count is started. The count is also started at the rising edge of event input from the ELC
while the TCSTF bit is 1. When the count value reaches 00h and then it is reloaded, the count is stopped. The
count is also stopped by any of the following settings:
When 1 (one-shot count stops) is written to the TOSSP bit in the TRBOCR register, the count is stopped.
When 0 (count stops) is written to the TSTART bit in the TRBCR register, 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.
When registers TRBPRE and TRBPR are read, each count value can be read. When registers TRBPRE and
TRBPR 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.
For the setting of trigger by the INT0 input, refer to 16.7 INT0 Input Trigger Selection.
Note:
1. After 1 is written to bits TOSST and TOSSP, a valid trigger is input to the INT0 pin, the rising edge for
event input from the event link controller (ELC), or 0 is written to the TSTART bit, settings are reflected
in the counter operation after three cycles of the count source.
Monitor the TOSSTF bit in the TRBOCR register to confirm the operating state of the counter.