R01UH0823EJ0100 Rev.1.00 Page 537 of 1823
Jul 31, 2019
RX23W Group 23. Multi-Function Timer Pulse Unit 2 (MTU2a)
(1) Example of PWM Mode Setting Procedure
Figure 23.25 shows an example of the PWM mode setting procedure.
Figure 23.25 Example of PWM Mode Setting Procedure
(2) Examples of PWM Mode Operation
Figure 23.26 shows an example of operation in PWM mode 1.
In this example, TGRA compare match is set as the TCNT clearing source, a low level is set as the initial output value
and output value for the TGRA register, and a high level is set as the output value for the TGRB register.
In this case, the value set in the TGRA register is used as the cycle, and the value set in the TGRB register is used as the
duty.
Figure 23.26 Example of PWM Mode Operation
[2]
[3]
[4]
[5]
[6]
[7]
[1] Enable TOER output when outputting a waveform from the
MTIOC pin of MTU3 and MTU4.
[2] Set the TCR.TPSC[2:0] bits to select the count clock source.
At the same time, set the TCR.CKEG[1:0] bits to select the
clock edge.
[3] Set the TCR.CCLR[2:0] bits to select the TGR register to be
used as the TCNT clearing source.
[4] Select the PWM mode with the TMDR.MD[3:0] bits.
[5] Use the TIOR register to designate the TGR register as an
output compare register, and select the initial value and
output value.
[6] Set the cycle in the TGR register selected in [3], and set the
duty in the other TGR registers.
[7] Set the TSTR.CSTn bit to 1 to start the count operation.
PWM mode
Select count clock
Select counter clearing
source
Set PWM mode
Select waveform output
level
Set TGR
Start count
PWM mode
[1]
Enable waveform output
TGRA
0000h
MTIOCnA
Time
TGRB
Counter cleared by TGRA compare match
TCNT value