User’s Manual U11969EJ3V0UM00
189
CHAPTER 7 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(2) External count clock
The signal input to the TI2n pins are counted. At this time, timer 2 operates as an event counter.
To set an external count clock see the table below.
PRM2n3
PRM2n2
PRM2n1
PRM2n0
External Count Clock
1
1
1
1
TI2n input
The valid edge of TI2n is specified by the ES bits of the INTM3 and the INTM4 registers.
ES2n1
ES2n0
Valid Edge
0
0
Falling edge
0
1
Rising edge
1
0
RFU (reserved)
1
1
Both rising and falling edges
Remark
n = 0 to 4
7.6.3 Overflow
If TM2n overflows as a result of counting the internal count clock, a flag is set to the OVF2n bit of the TOVS register
(n = 0 to 4).
7.6.4 Clearing/starting timer
There are two methods of clearing/starting timer 2: by coincidence with a compare register and by software.
(1) Clearing/starting by coincidence signal of a compare register
When the set value of the compare register (CM2n) and the value of TM2n coincide, TM2n clears its value
at the next count clock and starts count operation (n = 0 to 4). At the same time, it generates an interrupt request
signal (INTCM20 to INTCM24) and a timer output trigger.
The interval time set to a compare register can be calculated by the following expression:
(Set value + 1) x Count cycle
For the details, refer to 7.6.5 Compare operation.
(2) Clearing/starting by software
When the value of the CS2n bit of the TMC2n register is set to 1, TM2n clears its value at the next count clock
and starts count operation (n = 0 to 4). However, the setting of this bit is valid only when the value of the CE2n
bit is 1 (n = 0 to 4).
7.6.5 Compare operation
A comparison can be performed with the counter values of TM20 to TM24 and the compare registers (CM20 to
CM24).
When the count value of TM2n coincides with the value of the compare register, a coincidence interrupt (INTCM2n)
is generated. As a result, TM2n is cleared to 0 at the next count timing (refer to Figure 7-17). This function allows
timer 2 to be used as an interval timer.
CM2n can be also set to 0. In this case, a coincidence is detected when TM2n overflows and is cleared to 0, and
INTCM2n is generated. The value of TM2n is cleared to 0 at the next count timing, but INTCM2n is not generated
when a coincidence occurs at this time (refer to Figure 7-18).
Remark
n = 0 to 4
Содержание V854 UPD703006
Страница 2: ...2 User s Manual U11969EJ3V0UM00 MEMO ...
Страница 22: ...22 User s Manual U11969EJ3V0UM00 MEMO ...
Страница 80: ...80 User s Manual U11969EJ3V0UM00 MEMO ...
Страница 134: ...134 User s Manual U11969EJ3V0UM00 MEMO ...
Страница 156: ...156 User s Manual U11969EJ3V0UM00 MEMO ...
Страница 294: ...294 User s Manual U11969EJ3V0UM00 MEMO ...
Страница 320: ...320 User s Manual U11969EJ3V0UM00 MEMO ...
Страница 324: ...324 User s Manual U11969EJ3V0UM00 MEMO ...
Страница 336: ...336 User s Manual U11969EJ3V0UM00 MEMO ...
Страница 376: ...376 User s Manual U11969EJ3V0UM00 MEMO ...
Страница 382: ...382 User s Manual U11969EJ3V0UM00 MEMO ...
Страница 394: ...394 User s Manual U11969EJ3V0UM00 MEMO ...
Страница 396: ...396 User s Manual U11969EJ3V0UM00 MEMO ...