R01UH0823EJ0100 Rev.1.00
Page 698 of 1823
Jul 31, 2019
RX23W Group
25. 16-Bit Timer Pulse Unit (TPUa)
(1) Example of PWM Mode Setting Procedure
shows an example of the PWM mode setting procedure.
Figure 25.20
Example of PWM Mode Setting Procedure
Select count clock
PWM mode
Select counter clearing source
Select waveform output level
<PWM mode>
[1]
[2]
[3]
Set TGRy
Set PWM mode
Start counting
[4]
[5]
[6]
[1] Select the count clock with the TPSC[2:0] bits in
TCR. At the same time, select the input clock
edge with the CKEG[1:0] bits in TCR.
[2] Select the TGRy register to be used as the
TCNT clearing source with the CCLR[2:0] bits in
TCR (y = A to D).
[3] Set TGRy as an output compare register by
TIOR, and select the initial value and output
value.
[4] Set the cycle in TGRy selected in [2], and set the
duty in the other TGRy registers.
[5] Select the PWM mode with the MD[3:0] bits in
TMDR.
[6] Set the TPU.TSTR.CSTj bit (j = 0 to 5) to 1 to
start the counter operation.