R01UH0822EJ0100 Rev.1.00
Page 418 of 1041
Jul 31, 2019
RX13T Group
19. Multi-Function Timer Pulse Unit 3 (MTU3c)
(3) 16-Bit Phase Counting Mode Application Example
shows an example in which MTU1 is in phase counting mode, and MTU1 is coupled with MTU0 to input
2-phase encoder pulses of a servo motor in order to detect position or speed.
MTU1 is set to phase counting mode 1, and the encoder pulse A-phase and B-phase are input to MTCLKA and
MTCLKB.
In MTU0, MTU0.TGRC compare match is specified as the TCNT clearing source and MTU0.TGRA and MTU0.TGRC
are used for the compare match function and are set with the speed control period and position control period.
MTU0.TGRB is used for input capture, with MTU0.TGRB and MTU0.TGRD operating in buffer mode. The MTU1
count clock is designated as the MTU0.TGRB input capture source, and the widths of 2-phase encoder 4-multiplication
pulses are detected.
MTU1.TGRA and MTU1.TGRB for MTU1 are designated for the input capture function and MTU0.TGRA and
MTU0.TGRC compare matches in MTU0 are selected as the input capture sources to store the up/down-counter values
for the control periods.
This procedure enables the accurate detection of position and speed.
Figure 19.40
16-Bit Phase Counting Mode Application Example
MTCLKA
MTCLKB
MTU1
Edge
detection
circuit
MTU1.TCNT
MTU1.TGRA
(Speed period capture)
MTU1.TGRB
(Position period capture)
MTU0.TCNT
MTU0.TGRA
(Speed control period)
MTU0.TGRC
(Position control period)
MTU0
MTU0.TGRB
(Pulse width capture)
MTU0.TGRD
(Buffer operation)