CHAPTER 9 8-BIT TIMERS 30 AND 40
User’s Manual U14826EJ5V0UD
93
9.4 8-Bit Timers 30, 40 Operation
9.4.1 Operation as 8-bit timer counter
Timer 30 and timer 40 can independently be used as an 8-bit timer counter.
The following modes can be used for the 8-bit timer counter.
•
Interval timer with 8-bit resolution
•
External event counter with 8-bit resolution (timer 40 only)
•
Square wave output with 8-bit resolution (timer 40 only)
(1) Operation as interval timer with 8-bit resolution
The interval timer with 8-bit resolution repeatedly generates an interrupt at a time interval specified by the
count value preset in 8-bit compare register n0 (CRn0).
To operate 8-bit timer n0 as an interval timer, settings must be made in the following sequence.
<1> Disable operation of 8-bit timer counter n0 (TMn0) (TCEn0 = 0).
<2> Disable timer output of TMO (TOE40 = 0)
Note
.
<3> Set a count value in CRn0.
<4> Set the operation mode of timer n0 to 8-bit timer counter mode (see
Figures 9-4
and
9-5
).
<5> Set the count clock for timer n0 (see
Tables 9-3
to
9-6
).
<6> Enable the operation of TMn0 (TCEn0 = 1).
When the count value of 8-bit timer counter n0 (TMn0) matches the value set in CRn0, TMn0 is cleared to 0
and continues counting. At the same time, an interrupt request signal (INTTMn0) is generated.
Tables 9-3 to 9-6 show interval time, and Figures 9-8 to 9-13 show the timing of the interval timer operation.
Note
Timer 40 only
Caution Be sure to stop the timer operation before overwriting the count clock with different data.
Remark
n = 3, 4