171
CHAPTER 7 8-BIT TIMERS A0, B0
User’s Manual U15798EJ2V0UD
(2) Operation as external event counter with 8-bit resolution (timer B0 only)
The external event counter counts the number of external clock pulses input to the TMIB0/P07/TOA0 pin by using
8-bit timer counter B0 (TMB0).
To operate timer B0 as an external event counter, settings must be made in the following sequence.
<1>
Disable operation of 8-bit timer counter B0 (TMB0) (TCEB0 = 0).
<2>
Disable timer output of TOB0 (TOEB0 = 0).
<3>
Set P07 to input mode (PM07 = 1).
<4>
Select the external input clock for timer B0 (see
Table 7-4
).
<5>
Set the operation mode of timer B0 to 8-bit timer counter mode (see
Figures 7-4
and
7-5
).
<6>
Set a count value in CRB0.
<7>
Enable the operation of TMB0 (TCEB0 = 1).
Caution This operation only applies to timer B0. Timer A0 cannot be used as an external event counter
because it does not have a timer input pin.
Each time the valid edge is input, the value of TMB0 is incremented.
When the count value of TMB0 matches the value set in CRB0, TMB0 is cleared to 00H and continues counting.
At the same time, an interrupt request signal (INTTMB0) is generated.
Figure 7-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 7-14. Timing of Operation of External Event Counter with 8-Bit Resolution
TMIB0 pin input
TMB0 count value
CRB0
TCEB0
INTTMB0
00H
01H
02H
03H
04H
05H
N
−
1
N
00H
01H
02H
03H
N
Remark
N = 00H to FFH
Содержание mPD780344 Series
Страница 2: ...2 User s Manual U15798EJ2V0UD MEMO...