174
CHAPTER 7 8-BIT TIMERS A0, B0
User’s Manual U15798EJ2V0UD
7.4.2 Operation as 16-bit timer counter
Timer A0 and timer B0 can be used as a 16-bit timer counter using cascade connection. In this case, 8-bit timer
counter A0 (TMA0) is the higher 8 bits and 8-bit timer counter B0 (TMB0) is the lower 8 bits. 8-bit timer B0 controls
reset and clear.
The following modes can be used for the 16-bit timer counter.
•
Interval timer with 16-bit resolution
•
External event counter with 16-bit resolution
•
Square-wave output with 16-bit resolution
(1) Operation as interval timer with 16-bit resolution
The interval timer with 16-bit resolution repeatedly generates an interrupt at a time interval specified by the count
value preset in 8-bit compare register A0 (CRA0) and 8-bit compare register B0 (CRB0).
To operate as an interval timer with 16-bit resolution, settings must be made in the following sequence.
<1>
Disable operation of 8-bit timer counter A0 (TMA0) and 8-bit timer counter B0 (TMB0) (TCEA0 = 0, TCEB0
= 0).
<2>
Disable timer output of TOA0, TOB0 (TOEA0 = 0, TOEB0 = 0).
<3>
Set the count clock for timer B0 (see
Table 7-6
).
<4>
Set the operation mode of timer A0 and 8-bit timer B0 to 16-bit timer counter mode (see
Figures 7-4
and
7-5
).
<5>
Set a count value in CRA0 and CRB0.
<6>
Enable the operation of TMA0 and TMB0 (TCEB0 = 1
Note
).
Note
Start and clear of the timer in the 16-bit timer counter mode are controlled by TCEB0 (the value of TCEA0
is invalid).
When the count values of TMA0 and TMB0 match the values set in CRA0 and CRB0 respectively, both TMA0
and TMB0 are simultaneously cleared to 00H and counting continues. At the same time, an interrupt request
signal (INTTMB0) is generated (INTTMA0 is not generated).
Table 7-6 shows interval time, and Figure 7-16 shows the timing of the interval timer operation.
Cautions 1. Be sure to stop the timer operation before overwriting the count clock with different data.
2. In the 16-bit timer counter mode, TOA0 cannot be used. Be sure to set TOEA0 = 0 to disable
TOA0 output.
Содержание mPD780344 Series
Страница 2: ...2 User s Manual U15798EJ2V0UD MEMO...