RL78/G10 CHAPTER 6 TIMER ARRAY UNIT
R01UH0384EJ0311 Rev. 3.11 197
Dec 22, 2016
6.9.2 Two-channel input with one-shot pulse output function
By using signal input to two pins (TI0n and TI0p), a one-shot pulse having any delay pulse width can be generated. The
two-channel input with one-shot pulse output function is provided only in the 16-pin products.
The output delay time and one-shot pulse width can be calculated by the following expressions.
Delay time = {Set value of TDR0n (master) + 2} × count clock period
One-shot pulse active-level width =
count clock period × ((10000H + TSR0p:OVF) + (capture value of TDR0p (slave) + 1)
Caution The TI0n and TI0p pin inputs are each sampled using the operating clock (f
MCK) selected with the
CKS0n1 bit of the timer mode register (TMR0n), so an error of one cycle of the operating clock (f
MCK)
per pin occurs.
The master channel should be operated in the one-count mode to start counting the delays (output delay time) upon
detection of a valid edge of the master channel TI0n pin input used as the start trigger. Upon detection of a start trigger
(valid edge of TI0n pin input), the master channel loads the value of timer data register 0n (TDR0n) to the timer count
register 0n (TCR0n), and performs counting down in synchronization with the count clock (f
TCLK).
When TCR0n = 0000H, the master channel outputs INTTM0n and outputs the active level from the TO0p pin. It stops
counting until the next start trigger is detected.
The slave channel should be operated in the capture mode to set the one-shot pulse to the inactive level upon
detection of a valid edge of the slave channel TI0n pin input used as the end trigger. Upon detection of an end trigger
(valid edge of TI0p pin input), the slave channel transfers (captures) the count value of the TCR0p register to the TDR0p
register, and clears it to 0000H. Simultaneously, the slave channel outputs INTTM0p and the inactive level from the TO0p
pin. Here, if the counter overflow has occurred, the OVF bit in the timer status register 0n (TSR0p) is set; if not, the OVF
bit is cleared. After this, the same steps are repeated.
When the count value is captured to the TDR0p register, the OVF bit in the TSR0p register is updated depending on
the overflow status during the active level period, which allows the overflow status of the captured value to be checked.
If the counter reaches a full count for two or more periods, it is judged to be an overflow occurrence, and the OVF bit of
the TSR0p register is set to 1. However, a normal interval value cannot be measured for the OVF bit, if two or more
overflows occur.
Instead of using the TI0n pin input, the software operation (TS0n = 1) can be used as a start trigger for the master
channel.
Remark n: Master channel number (n = 0, 2)
p: Slave channel number (p = 3)