R01UH0823EJ0100 Rev.1.00
Page 623 of 1823
Jul 31, 2019
RX23W Group
23. Multi-Function Timer Pulse Unit 2 (MTU2a)
(13) Operation When Error Occurs in PWM Mode 2 and Operation is Restarted in Normal Mode
shows a case in which an error occurs in PWM mode 2 and operation is restarted in normal mode after
re-setting.
Figure 23.128
Error Occurrence in PWM Mode 2, Recovery in Normal Mode
(1) After a reset, the MTU output goes low and the ports enter high-impedance state.
(2) Set PWM mode 2.
(3) Initialize the pins with the TIOR register. (In the example, the initial output is a high level, and a low level is output
on compare match occurrence. In PWM mode 2, the cycle register pins are not initialized. In the example,
MTIOCnA is the cycle register.)
(4) Use the MPC and the port mode register (PMR) for the I/O port to set up MTU output.
(5) Start count operation by setting the TSTR register.
(6) Output goes low on compare match occurrence.
(7) An error occurs.
(8) Use the port direction register (PDR) and port mode register (PMR) for the input port pin to switch it to operate as a
(9) Stop count operation by setting the TSTR register.
(10) Set normal mode.
(11) Initialize the pins with the TIOR register.
(12) Use the MPC and the port mode register (PMR) for the I/O port to set up MTU output.
(13) Restart operation by setting the TSTR register.
MTU module output
(1)
Reset
(2)
TMDR
(PWM2)
(3)
TIOR
(1 init
0 out)
(5)
TSTR
(1)
(6)
Match
(7)
Error
occurs
(8)
Port
output
(9)
TSTR
(0)
(10)
TMDR
(normal)
(11)
TIOR
(1 init
0 out)
(13)
TSTR
(1)
PORT output
Pxx
Pxx
MTIOCnA
MTIOCnB
(4)
MPC
(MTU)
(12)
MPC
(MTU)
Hi-Z
Hi-Z
Not initialized (cycle register)