![](http://datasheet.mmic.net.cn/370000/UPD703215_datasheet_16743812/UPD703215_356.png)
CHAPTER 9 8-BIT TIMER/EVENT COUNTER 5
User’s Manual U16890EJ1V0UD
356
9.4.6 Operation as external event counter (16 bits)
The 16-bit resolution timer/event counter mode is selected by setting the TMC51.TMC514 bit to 1.
The external event counter counts the number of clock pulses input to the TI50 pin from an external source using
16-bit timer counter 5 (TM5).
Setting method
<1> Set each register.
TCL50 register:
CR50 register:
CR51 register:
TMC50, TMC51 registers: Stops count operation, selects the clear & stop mode entered on a match
between the TM5 register and CR5 register, disables timer output F/F
inversion, and disables timer output.
(
×
: don’t care)
TMC50 register = 0000xx00B
TMC51 register = 0001xx00B
For the alternate-function pin settings, refer to
Table 4-16 Settings When Port Pins Are Used for
Alternate Functions.
<2> Set the TMC51.TCE51 bit to 1. Then set the TMC50.TCE50 bit to 1 and count the number of pulses input
from the TI50 pin.
<3> When the values of the TM5 register and CR5 register connected in cascade match, the INTTM50 signal
is generated (the TM5 register is cleared to 0000H).
<4> The INTTM50 signal is then generated each time the values of the TM5 register and CR5 register match.
Selects the TI50 pin input edge.
(The TCL51 register does not have to be set during cascade connection.)
Falling edge of TI50 pin
→
TCL50 register = 00H
Rising edge of TI50 pin
→
TCL50 register = 01H
Compare value (N) ... Lower 8 bits (settable from 00H to FFH)
Compare value (N) ... Higher 8 bits (settable from 00H to FFH)
INTTM50 signal is generated when the valid edge of TI50 pin is input N + 1 times: N = 0000H to FFFFH
Cautions 1. During external event counter operation, do not rewrite the value of the CR5n
register.
2. To write using 8-bit access during cascade connection, set the TCE51 bit to 1 and
then set the TCE50 bit to 1. When operation is stopped, clear the TCE50 bit to 0 and
then clear the TCE51 bit to 0 (n = 0, 1).
3. During cascade connection, TI50 input and the INTTM50 signal are used. Do not use
TI51 input, TO51 output, and the INTTM51 signal; mask them instead (for details,
refer to CHAPTER 20 INTERRUPT/EXCEPTION PROCESSING FUNCTION). Clear the
LVS51, LVR51, TMC511, and TOE51 bits to 0.
4. Do not change the value of the CR5 register during external event counter operation.