CHAPTER 9 8-BIT TIMER/EVENT COUNTER
User’s Manual U13045EJ2V0UM00
122
9.4.2 Operation as external event counter
The external event counter counts the number of external clock pulses input to the TI80/P25/INTP2 pin by using
timer register 80 (TM80).
To operate the 8-bit timer/event counter as an external event counter, the following settings are required.
<1>
Set P25 to input mode (PM25 = 1)
<2>
Set 8-bit timer register 80 (TM80) to operation disable (by setting TCE80 (bit 7 of 8-bit timer mode control
register 80 (TMC80)) to 0).
<3>
Specify the rising/falling edges of TI80 (see Tables 9-4 and 9-5), and set TO80 to output disable (i.e. set
TOE80 (bit 0 of TMC80) to 0) and PWM output to disable (i.e. set PWME80 (bit 6 of TMC80) to 0).
<4>
Set the count value to CR80.
<5>
Set TM80 to operation enable (TCE80 = 1)
Each time the valid edge specified by bit 1 (TCL800) of TMC80 is input, the value of 8-bit timer register 80 (TM80)
is incremented.
When the count value of TM80 matches the value set to CR80, the value of TM80 is cleared to 0 and TM80 continues
counting. At the same time, an interrupt request signal (INTTM80) is generated.
Figure 9-5 shows the timing of the external event counter operation (with rising edge specified).
Cautions 1. Before rewriting CR80, stop the timer operation once. If CR80 is rewritten in the timer
operation-enabled state, a match interrupt request signal may occur at the moment of rewrite.
2. If the count clock setting and TM80 operation-enabled are set in TMC80 simultaneously using
an 8-bit memory manipulation instruction, an error of more than one clock in one cycle may
occur after the timer starts.
Therefore, always follow the above procedure when operating the 8-bit timer/event counter
as an interval timer.
Figure 9-5. External Event Counter Operation Timing (with Rising Edge Specified)
Remark
N = 00H to FFH
TI80 pin input
TM80 count value
CR80
TCE80
INTTM80
00H
01H
02H
03H
04H
05H
N – 1
N
00H
01H
02H
03H
N
Содержание mPD789101
Страница 2: ...2 User s Manual U13045EJ2V0UM00 MEMO...
Страница 10: ...10 User s Manual U13045EJ2V0UM00 MEMO...
Страница 16: ...User s Manual U13045EJ2V0UM00 16 MEMO...
Страница 46: ...User s Manual U13045EJ2V0UM00 46 MEMO...
Страница 72: ...72 User s Manual U13045EJ2V0UM00 MEMO...
Страница 86: ...User s Manual U13045EJ2V0UM00 86 MEMO...
Страница 94: ...User s Manual U13045EJ2V0UM00 94 MEMO...
Страница 102: ...User s Manual U13045EJ2V0UM00 102 MEMO...
Страница 128: ...User s Manual U13045EJ2V0UM00 128 MEMO...
Страница 148: ...User s Manual U13045EJ2V0UM00 148 MEMO...
Страница 162: ...User s Manual U13045EJ2V0UM00 162 MEMO...
Страница 218: ...User s Manual U13045EJ2V0UM00 218 MEMO...
Страница 238: ...User s Manual U13045EJ2V0UM00 238 MEMO...
Страница 240: ...User s Manual U13045EJ2V0UM00 240 MEMO...
Страница 256: ...User s Manual U13045EJ2V0UM00 256 MEMO...
Страница 258: ...258 User s Manual U13045EJ2V0UM00 MEMO...
Страница 264: ...User s Manual U13045EJ2V0UM00 264 MEMO...