![](http://datasheet.mmic.net.cn/120000/R5F21388SDFP_datasheet_3573603/R5F21388SDFP_339.png)
R8C/38T-A Group
17. Timer RC
Under development Preliminary document
Specifications in this document are tentative and subject to change.
R01UH0241EJ0010 Rev.0.10
Page 308 of 730
Aug 05, 2011
In PWM2 mode, the TRCTRG input is used to output a pulse with an arbitrary delay time and width from the
TRCIOB pin.
Set bits TCEG1 and TCEG0 in the TRCCR2 register to 10b (falling edge) to set the falling edge for the
TRCTRG input. Set the CSTP bit in the TRCCR2 register to 0 (increment continues) to continue incrementing
when compare match A with the TRCGRA register occurs. Set the BUFEB bit in the TRCMR register to 1
(TRCGRD register is used as a buffer register for TRCRGB register) to set the TRCGRD register as the buffer
register. Set the TOB bit in the TRCCR1 register to 0 (output value is low) or 1 (output value is high) to set the
initial level of the output level to 0 or 1. Next, set the CCLR bit in the TRCCR1 register to 1 (TRCCNT counter
is cleared by input capture/compare match A) to clear the TRCCNT register by compare match A.
the PWM2 bit in the TRCMR register is set to 0 (PWM2 mode) and a waveform is output from the TRCIOB
pin.
In PWM2 mode, when the TOB bit in the TRCCR1 register is 0 (output value is low), the TRCTRG input edge
is cancelled while a high level is output from the TRCIOB pin. Likewise, when the TOB bit is 1 (output value is
high), the TRCTRG input edge is cancelled while a low level is output from the TRCIOB pin. In addition,
transfer from registers TRCGRD to TRCGRB is performed when a compare match with the TRCGRA register
or TRCTRG input occurs. However, if the TRCTRG input is cancelled depending on the level of the TRCIOB
pin, transfer from registers TRCGRD to TRCGRB is not performed.
Figure 17.14
Operation Example in PWM2 Mode when TRCTRG Input is Enabled
0000h
TRCCNT register value
Time
TRCGRB register
TRCGRC register
TRCGRA register
FFFFh
TRCIOB
(output change when TOB = 0)
TRCIOB
(output change when TOB = 1)
TRCGRD register
TRCGRB register
B
C
A
TOB: Bit in TRCCR1 register
TRCTRG input under the following states is cancelled.
TOB = 0 (output value is low), during high output
TOB = 1 (output value is high), during low output
B
C
A
D
TRCIOA/TRCTRG