CHAPTER 7 8-BIT TIMERS 50, 60, AND 61
User’s Manual U15331EJ4V1UD
148
(3) Operation as square-wave output with 16-bit resolution
Square waves of any frequency can be output at an interval specified by the count value preset in CR50 and
CR60.
To operate as a square-wave output with 16-bit resolution, settings must be made in the following sequence.
<1> Disable operation of TM50 and TM60 (TCE50 = 0, TCE60 = 0).
<2> Disable output of TO50 and TO60 (TOE50 = 0, TOE600 = 0).
<3> Set a count clock for timer 60. (see Figure 7-7)
<4> Set P31 to the output mode (PM31 = 0), set the P31 output latch to 0, and set TO60 to output enable
(TOE600 = 1). (Use of TO50 is prohibited.)
<5> Set the operation mode of timer 50 and timer 60 to 16-bit timer counter mode (see Figures 7-6 and 7-7).
<6> Set count values in CR50 and CR60.
<7> Enable the operation of TM60 (TCE60 = 1
Note
).
Note
Start and clear of the timer in the 16-bit timer counter mode are controlled by TCE60 (the value of
TCE50 is invalid).
When the count values of TM50 and TM60 simultaneously match the values set in CR50 and CR60
respectively, the TO60 pin output will be inverted. Through application of this mechanism, square waves of
any frequency can be output. As soon as a match occurs, TM50 and TM60 are cleared to 00H and continue
counting. At the same time, an interrupt request signal (INTTM60) is generated (INTTM50 is not generated).
The square-wave output is cleared to 0 by setting TCE60 to 0.
Table 7-10 shows the square-wave output range, and Figure 7-21 shows timing of square-wave output.
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, TO50 cannot be used. Be sure to set TOE50 = 0 to
disable TO50 output.
Table 7-10. Square-Wave Output Range with 16-Bit Resolution
TCL602 TCL601 TCL600
Minimum Pulse Width
Maximum Pulse Width
Resolution
0 0 0
1/f
X
(0.2
µ
s)
2
16
/f
X
(13.1 ms)
1/f
X
(0.2
µ
s)
0 0 1
2
2
/f
X
(0.8
µ
s)
2
18
/f
X
(52.4 ms)
2
2
/f
X
(0.8
µ
s)
0 1 0
f
TMI
input cycle
f
TMI
input cycle
×
2
16
f
TMI
input cycle
0 1 1
f
TMI
/2 input cycle
f
TMI
/2 input cycle
×
2
16
f
TMI
/2 input cycle
1 0 0
f
TMI
/2
2
input cycle
f
TMI
/2
2
input cycle
×
2
16
f
TMI
/2
2
input cycle
1 0 1
f
TMI
/2
3
input cycle
f
TMI
/2
3
input cycle
×
2
16
f
TMI
/2
3
input cycle
Remarks
1.
f
X
: Main system clock oscillation frequency
2.
f
TMI
: External input clock frequency
3.
The parenthesized values apply to operation at f
X
= 5.0 MHz.