CHAPTER 9 8-BIT TIMERS 30 AND 40
User’s Manual U14826EJ5V0UD
107
(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 CR30 and
CR40.
To operate as a square-wave output with 16-bit resolution, settings must be made in the following sequence.
<1> Disable operation of TM30 and TM40 (TCE30 = 0, TCE40 = 0).
<2> Disable output of TMO (TOE40 = 0).
<3> Set a count clock for timer 40.
<4> Clear P20 to output mode (PM20 = 0) and P20 output latch to 0 and enable TMO output (TOE40 = 1).
<5> Set count values in CR30 and CR40.
<6> Enable the operation of TM40 (TCE40 = 1
Note
).
Note
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 simultaneously match the values set in CR30 and CR40
respectively, the TMO pin output will be inverted. Through application of this mechanism, square waves of
any frequency can be output. As soon as a match occurs, TM30 and TM40 are cleared to 00H and counting
continues. At the same time, an interrupt request signal (INTTM40) is generated (INTTM30 is not generated).
The square-wave output is cleared to 0 by setting TCE40 to 0.
Tables 9-11 and 9-12 show the square wave output range, and Figure 9-18 shows timing of square wave
output.
Caution Be sure to stop the timer operation before overwriting the count clock with different data.
Table 9-11. Square-Wave Output Range with 16-Bit Resolution (During f
X
= 5.0 MHz Operation)
TCL402 TCL401 TCL400
Minimum Pulse Time
Maximum Pulse Time
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)
Remark
f
X
: System clock oscillation frequency (ceramic/crystal oscillation)
Table 9-12. Square-Wave Output Range with 16-Bit Resolution (During f
CC
= 1.0 MHz Operation)
TCL402 TCL401 TCL400
Minimum Pulse Time
Maximum Pulse Time
Resolution
0 0 0
1/f
CC
(1.0
µ
s)
2
16
/f
CC
(65.5 ms)
1/f
CC
(1.0
µ
s)
0 0 1
2
2
/f
CC
(4.0
µ
s) 2
18
/f
CC
(262.1 ms)
2
2
/f
CC
(4.0
µ
s)
Remark
f
CC
: System clock oscillation frequency (RC oscillation)