CHAPTER 7 8-BIT TIMERS 50, 60, AND 61
User’s Manual U15331EJ4V1UD
141
(3) Operation as square-wave output with 8-bit resolution
Square waves of any frequency can be output at an interval specified by the value preset in 8-bit compare
register nm (CRnm).
To operate timer nm for square-wave output, settings must be made in the following sequence.
<1> When using timer 50, set P30 to output mode (PM30 = 0) and the P30 output latch to 0, respectively.
When using timer 60, set P31 to output mode (PM31 = 0) and the P31 output latch to 0, respectively.
When using timer 61, set P32 to output mode (PM32 = 0) and the P32 output latch to 0, respectively.
<2> Disable operation of timer counter nm (TMnm) (TCEnm = 0).
<3> Set a count clock for timer nm (see
Figures 7-6
,
7-7
and
7-9
)
<4> For timer 50, enable timer output of TO50 (TOE50 = 1).
For timer 60, enable timer output of TO60 (TOE600 = 1).
For timer 61, enable timer output of TO61 (TOE610 = 1).
<5> Set a count value in CRnm.
<6> Enable the operation of TMnm (TCEnm0 = 1).
When the count value of TMnm matches the value set in CRnm, the TOnm pin output will be inverted.
Through application of this mechanism, square waves of any frequency can be output. As soon as a match
occurs, TMnm is cleared to 00H and continues counting. At the same time, an interrupt request signal
(INTTMnm) is generated.
The square-wave output is cleared to 0 by setting TCEnm to 0.
Tables 7-6 to 7-8 show the square-wave output range, and Figure 7-18 shows the timing of square-wave
output.
Caution Be sure to stop the timer operation before overwriting the count clock with different data.
Remark
nm = 50, 60, 61
Table 7-6. Square-Wave Output Range of Timer 50
TCL502 TCL501 TCL500
Minimum
Pulse
Width
Maximum Pulse Width
Resolution
0 0 0
1/f
X
(0.2
µ
s) 2
8
/f
X
(51.2
µ
s) 1/f
X
(0.2
µ
s)
0 0 1
2
3
/f
X
(1.6
µ
s) 2
11
/f
X
(409.6
µ
s) 2
3
/f
X
(1.6
µ
s)
0 1 0
2
7
/f
X
(25.6
µ
s) 2
15
/f
X
(6.55 ms)
2
7
/f
X
(25.6
µ
s)
0 1 1
1/f
XT
(30.5
µ
s) 2
8
/f
XT
(7.81 ms)
1/f
XT
(30.5
µ
s)
1
0
0
Input cycle of timer 60 match
signal
Input cycle of timer 60 match
signal
×
2
8
Input cycle of timer 60 match
signal
1
0
1
Input cycle of timer 60 output
Input cycle of timer 60 output
×
2
8
Input cycle of timer 60 output
Remarks
1.
f
X
: Main system clock oscillation frequency
2.
f
XT
: Subsystem clock oscillation frequency
3.
The parenthesized values apply to operation at f
X
= 5.0 MHz or f
XT
= 32.768 kHz.