114
CHAPTER 6 8-BIT TIMER/EVENT COUNTERS 50 TO 53
User’s Manual U15104EJ2V0UD
6.4.5 Interval timer operation (16-bit)
When using the 8-bit timer/counters as a 16-bit timer, be sure to use a combination of timers 50 and 51 or timers
52 and 53. The following section describes the case when using timers 50 and 51. When using timers 52 and 53,
read “50” as “52” and “51” as “53”.
The 8-bit timer/event counters are used together in 16-bit timer/counter mode when bit 4 (TMC514) of 8-bit timer
mode control register 51 (TM51) is set to 1.
In this mode, the 8-bit timer/event counters are used as a 16-bit interval timer that repeatedly generates an interrupt
request at intervals specified by the count value set in advance in the 8-bit compare registers (CR50 and CR51).
At this time, CR50 serves as the lower 8 bits of the 16-bit compare register, and CR51 serves as the higher 8 bits.
[Setting]
<1> Set each register.
•
TCL50:
Select the count clock for TM50.
The count clock for TM51, which is cascaded, does not have to be set.
•
CR50 and CR51:
Compare values. (Each compare value can be set in a range of 00H to FFH.)
•
TMC50 and TMC51:
Select a mode in which the interval timer is cleared and started on match between
TM50 and CR50 (or between TM51 and CR51).
TM50
→
TMC50 = 0000
×××
0B
×
: Don’t care
TM51
→
TMC51 = 0001
×××
0B
×
: Don’t care
<2> The count operation is started by setting TCE51 of TMC51 to 1 first, and then TCE50 of TMC50 to 1.
<3> If the value of cascaded timer TM50 matches the value of CR50, INTTM50 of TM50 is generated (TM50 and
TM51 are cleared to 00H).
<4> After that, INTTM50 is repeatedly generated at fixed intervals.
Cautions 1. Be sure to set the compare registers (CR50 and CR51) after stopping the timer operation.
2. Even if the 8-bit timers/counters are cascaded, INTTM51 of TM51 is generated when the
count value of TM51 matches CR51. Be sure to mask TM51 to disable this interrupt.
3. Set TCE50 and TCE51 in the order of TM51 and TM50.
4. Counting can be restarted or stopped by setting or resetting TCE50 of TM50 to 1 or 0.
Figure 6-14 shows a timing example in the 16-bit resolution cascade mode.