R01UH0823EJ0100 Rev.1.00
Page 519 of 1823
Jul 31, 2019
RX23W Group
23. Multi-Function Timer Pulse Unit 2 (MTU2a)
23.3
Operation
23.3.1
Basic Functions
Each channel has the TCNT counter and the TGR register. The TCNT counter performs up-counting, and is also capable
of free-running operation, periodic counting, and external event counting.
Each TGR register can be used as an input capture register or an output compare register.
(1) Counter Operation
When one of bits CST0 to CST4 in the TSTR register is set to 1, the TCNT counter for the corresponding channel begins
counting. The TCNT counter can operate as a free-running counter, periodic counter, for example.
(a) Example of Count Operation Setting Procedure
shows an example of the count operation setting procedure.
Figure 23.4
Example of Counter Operation Setting Procedure
[1] 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.
[2] For periodic counter operation, select the TGR
register to be used as the TCNT clearing source by
setting the TCR.CCLR[2:0] bits.
[3] Designate the TGR register selected in [2] as an
output compare register by means of the TIOR
register.
[4] Set the periodic counter cycle in the TGR register
selected in [2].
[5] Set the TSTR.CSTn bit to 1 to start the counter
operation.
Periodic counter
Free-running counter
Select count clock
Operation selection
Periodic counter
Set period
Select output compare
register
Select counter clearing
source
Start count operation
Free-running counter
Start count operation
[1]
[2]
[3]
[4]
[5]
[5]