CHAPTER 9 8-BIT TIMERS 30 AND 40
User’s Manual U14826EJ5V0UD
102
9.4.2 Operation as 16-bit timer counter
Timer 30 and timer 40 can be used as a 16-bit timer counter using cascade connection. In this case, 8-bit timer
counter 30 (TM30) is the higher 8 bits and 8-bit timer counter 40 (TM40) is the lower 8 bits. 8-bit timer 40 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 30 (CR30) and 8-bit compare register 40 (CR40).
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 30 (TM30) and 8-bit timer counter 40 (TM40) (TCE30 = 0,
TCE40 = 0).
<2> Disable timer output of TMO (TOE40 = 0)
Note 1
.
<3> Set the count clock for timer 40 (see
Tables 9-9
and
9-10
).
<4> Set the operation mode of timer 30 and timer 40 to 16-bit timer counter mode (see
Figures 9-4
and
9-
5
).
<5> Set a count value in CR30 and CR40.
<6> Enable the operation of TM30 and TM40 (TCE40 = 1
Note 2
).
Notes
1.
Timer 40 only
2.
Start and clear of the timer in the 16-bit timer counter mode are controlled by TCE40 (the value
of TCE30 is invalid).
When the count values of TM30 and TM40 match the values set in CR30 and CR40 respectively, both TM30
and TM40 are simultaneously cleared to 00H and counting continues. At the same time, an interrupt request
signal (INTTM40) is generated (INTTM30 is not generated).
Tables 9-9 and 9-10 show interval time, and Figure 9-16 shows the timing of the interval timer operation.
Caution Be sure to stop the timer operation before overwriting the count clock with different data.