CHAPTER 9 8-BIT TIMERS 30 AND 40
User’s Manual U14826EJ5V0UD
99
(2) Operation as external event counter with 8-bit resolution (timer 40 only)
The external event counter counts the number of external clock pulses input to the TMI/P21 pin by using 8-bit
timer counter 40 (TM40).
To operate timer 40 as an external event counter, settings must be made in the following sequence.
<1> Disable operation of 8-bit timer counter 40 (TM40) (TCE40 = 0).
<2> Disable timer output of TMO (TOE40 = 0).
<3> Set P21 to input mode (PM21 = 1).
<4> Select the external input clock for timer 40 (see
Tables 9-5
and
9-6
).
<5> Set the operation mode of timer 40 to 8-bit timer counter mode (see
Figures 9-4
and
9-5
).
<6> Set a count value in CR40.
<7> Enable the operation of TM40 (TCE40 = 1).
Each time the valid edge is input, the value of TM40 is incremented.
When the count value of TM40 matches the value set in CR40, TM40 is cleared to 00H and continues
counting. At the same time, an interrupt request signal (INTTM40) is generated.
Figure 9-14 shows the timing of the external event counter operation.
Caution Be sure to stop the timer operation before overwriting the count clock with different data.
Figure 9-14. Timing of Operation of External Event Counter with 8-Bit Resolution
TMI pin input
TM40 count value
CR40
TCE40
INTTM40
00H
01H
02H
03H
04H
05H
N
−
1
N
00H
01H
02H
03H
N
Remark
N = 00H to FFH
Содержание PD789860
Страница 2: ...User s Manual U14826EJ5V0UD 2 MEMO ...