R01UH0823EJ0100 Rev.1.00
Page 553 of 1823
Jul 31, 2019
RX23W Group
23. Multi-Function Timer Pulse Unit 2 (MTU2a)
(b) Register Operation
In complementary PWM mode, nine registers (compare registers, buffer registers, and temporary registers) are used to
control the duty ratio for the PWM output.
shows an example of operation in complementary PWM mode.
Registers MTU3.TGRB, MTU4.TGRA, and MTU4.TGRB are constantly compared with the counters to generate PWM
waveforms. When these registers match the counter, the value set in the TOCR1.OLSN and OLSP bits is output from the
PWM output pin.
Registers MTU3.TGRD, MTU4.TGRC, and MTU4.TGRD are buffer registers for these compare registers. Between a
buffer register and a compare register, there is a temporary register. The temporary registers cannot be accessed by the
CPU.
Data in a compare register can be changed by writing new data to the corresponding buffer register. The buffer registers
can be read or written at any time.
When modifying data in a buffer register, be sure to write to the MTU4.TGRD register last and enable data transfer from
the buffer register to a temporary register. At this time, transfer from registers TCBR and MTU3.TGRC, which operate
as buffer registers for the timer cycle registers, to temporary registers is also enabled. Data is transferred to all five
temporary registers at the same time. When transfer is enabled in the Ta interval, data written to a buffer register is
immediately transferred to the temporary register. Data is not transferred to the temporary register in the Tb1 and Tb2
intervals. Data enabled for transfer in this interval is transferred to the temporary register at the end of this interval.
The value transferred to a temporary register is transferred to the compare register at the end of the Tb1 interval (when
matches the MTU3.TGRA register while the TCNTS counter is counting up), or at the end of the Tb2 interval (when
matches 0000h while the TCNTS counter is counting down). The timing for transfer from the temporary register to the
compare register can be selected with the TMDR.MD[3:0] bits.
shows an example in which the trough is
selected for the transfer timing.
In the Tb (Tb2 in
) interval in which data is not transferred to the temporary register, the temporary register
has the same function as the compare register and is compared with the counter. In this interval, therefore, there are two
compare match registers for one output phase; the compare register contains the pre-change data and the temporary
register contains new data. In this interval, three counters (MTU3.TCNT, MTU4.TCNT and TCNTS) and two registers
(compare register and temporary register) are compared, and PWM output is controlled accordingly.