231
CHAPTER 10 TIMERS/COUNTERS 2 AND 3
(1) Timer register (TM2)
TM2 is a timer register that counts up the count clock specified by the low-order 3 bits of the prescaler mode register
2 (PRM2) (the count clock of TM3 is specified by bits 4 through 6 of PRM2).
Counting of this timer register is enabled or disabled by the timer mode control register 2 (TMC2).
The timer register can be only read by using a 16-bit manipulation instruction. When RESET is input, TM2 is cleared
to 0000H and stops counting.
(2) Compare registers (CM20, CM21)
CM2n (n = 0 or 1) is a 16-bit register that holds the value determining the cycle of the interval timer operation.
When the contents of CM2n matches with the contents of TM2, an interrupt request (INTCM2n: n = 0, 1) and a timer
output control signal are generated. The count value of TM2 can be cleared when its value matches with the contents
of CM2n.
These compare registers can be read or written by using 16-bit manipulation instructions. When RESET is input,
their contents are undefined.
(3) Edge detection circuit
The edge detection circuit detects the valid edge of an external input.
It detects the valid edge of the INTP5/TI2 pin input, and generates an external interrupt request (INTP5). The valid
edge to be detected is specified by external interrupt mode register 1 (INTM1) (for INTM1, refer to
Figure 15-2
).
(4) Output control circuit
When the contents of CM2n (n = 0, 1) and the contents of TM2 matches, the timer output can be inverted. A square
wave can be output from a timer output pin (TO20, TO21) if so specified by the timer output control register 2 (TOC2).
At this time, PWM/PPG output can also be specified by the timer unit mode register 2 (TUM2).
The timer output can be enabled or disabled by TOC2. When the timer output is disabled, a fixed level is output
to the TO2n (n = 0, 1) pin (the output level is set by TOC2).
(5) Prescaler
The prescaler generates a count clock by dividing the internal system clock. The clock generated by the prescaler
is selected by the selector, and TM2 performs the count operation by using this clock as a count clock.
(6) Selector
The selector selects one of the five signals generated by dividing the internal system clock and TI2 pin input as the
count clock of TM2.