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 (T OE50 = 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 = 1Note).
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/fX (0.2
µ
s) 216/fX (13.1 ms) 1/fX (0.2
µ
s)
0 0 1 22/fX (0.8
µ
s) 218/fX (52.4 ms) 22/fX (0.8
µ
s)
0 1 0 fTMI input cycle fTMI input cycle × 216 fTMI input cycle
0 1 1 fTMI/2 input cycle fTMI/2 input cycle × 216 fTMI/2 input cycle
1 0 0 fTMI/22 input cycle fTMI/22 input cycle × 216 fTMI/22 input cycle
1 0 1 fTMI/23 input cycle fTMI/23 input cycle × 216 fTMI/23 input cycle
Remarks 1. fX: Main system clock oscillation frequency
2. f
TMI: External input clock frequency
3. The parenthesized values apply to operation at fX = 5.0 MHz.