CHAPTER 9 TIMER/COUNTER FUNCTION
297
User’s Manual U15195EJ5V0UD
(1) Timer 10 (TM10)
TM10 is a general-purpose timer (in general-purpose mode) and 2-phase encoder input up/down counter (in
UDC mode).
This timer counts up in the general-purpose timer mode and counts up/down in the UDC mode.
It can be read/written in 16-bit units.
Cautions 1. Writing to TM10 is enabled only when the TM1CE0 bit of the TMC10 register is 0 (count
operation disabled).
2. Continuous reading of TM10 is prohibited. If TM10 is continuously read, the second
read value may differ from the actual value. If TM10 must be read twice, be sure to read
another register between the first and the second read operation.
3. Writing the same value to the TM10, CC100, and CC101 registers, and the STATUS10
register is prohibited.
Writing the same value to the CCR0, TUM0, TMC10, SESA10, and PRM10 registers, and
CM100 and CM101 registers is permitted (writing the same value is guaranteed even
during a count operation).
14
13
12
2
3
4
5
6
7
8
9
10
11
15
1
0
TM10
Address
FFFFF5E0H
After reset
0000H
TM10 start and stop is controlled by the TM1CE0 bit of timer control register 10 (TMC10).
The TM10 operation consists of the following two modes.
(a) General-purpose timer mode
In the general-purpose timer mode, TM10 operates as a 16-bit interval timer, free-running timer, or PWM
output.
Counting is performed based on the clock selected by software.
Division by the prescaler can be selected for the count clock from among f
CLK
/2, f
CLK
/4, f
CLK
/8, f
CLK
/16,
f
CLK
/32, f
CLK
/64, or f
CLK
/128 using the PRM12 to PRM10 bits of prescaler mode register 10 (PRM10).
(f
CLK
: base clock, refer to
9.2.4 (1) Timer 1/timer 2 clock selection register (PRM02)
).
(b) Up/down counter mode (UDC mode)
In the UDC mode, TM10 functions as a 16-bit up/down counter that performs counting based on the
TCUD10 and TIUD10 input signals.
This mode is divided into the UDC mode A and UDC mode B, depending on the condition of clearing
TM10.
The conditions for clearing TM10 are as follows, depending on the operation mode.