
CHAPTER 8 8-BIT TIMER/EVENT COUNTERS 50 AND 51
User
’
s Manual U15862EJ3V0UD
366
8.4.6 Operation as external event counter (16 bits)
The V850ES/KF1, V850ES/KG1, and V850ES/KJ1 are provided with a 16-bit register that can be used only during
cascade connection.
The 16-bit resolution timer/event counter mode is selected by setting the TMC514 bit of 8-bit timer mode control
register 51 (TMC51) 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:
Selects the TI50 input edge.
(The TCL51 register does not have to be set during cascade connection.)
Falling edge of TI50
→
TCL50 = 00H
Rising edge of TI50
→
TCL50 = 01H
Compare value (N) ... Lower 8 bits (settable from 00H to FFH)
Compare value (N) ... Higher 8 bits (settable from 00H to FFH)
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
Set the TCE51 bit of the TMC51 register to 1. Then set the TCE50 bit of the TMC50 register to 1 and
count the number of pulses input from TI50.
When the values of the TM5 register and CR5 register connected in cascade match, INTTM50 is
generated (the TM5 register is cleared to 0000H).
INTTM50 is then generated each time the values of the TM5 register and CR5 register match.
CR50 register:
CR51 register:
<2>
<3>
<4>
INTTM50 is generated when the valid edge of TI50 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, set the TCE50 bit to 0 and
then set the TCE51 bit to 0 (n = 0, 1).
3. During cascade connection, TI50 input and INTTM50 signal output are used while
TI51 input, TO51 output, and INTTM51 signal output are not, so set bits LVS51,
LVR51, TMC511, and TOE51 to 0.
4. Do not change the value of the CR5 register during external counter operation.