CHAPTER 9 8-BIT TIMER/EVENT COUNTER
User’s Manual U13045EJ2V0UM00
123
9.4.3 Operation as square wave output
The 8-bit timer/event counter can generate output square waves of a given frequency at intervals specified by the
count value set to the 8-bit compare register 80 (CR80) in advance.
To operate the 8-bit timer/event counter 80 for square wave output, the following settings are required.
<1>
Set P24 to output mode (PM24 = 0) and the P24 output latch to 0.
<2>
Set 8-bit timer register 80 (TM80) to operation disable (TCE80 = 0).
<3>
Set the count clock of the 8-bit timer/event counter (see Tables 9-4 and 9-5), TO80 to output enable (TOE80
= 1), and PWM output to disable (PWME80 = 0).
<4>
Set the count value to CR80.
<5>
Set TM80 to operation enable (TCE80 = 1).
When the count value of 8-bit timer register 80 (TM80) matches the value set in CR80, the TO80/P24/INTP1/TO20
pin output will be inverted. Through application of this mechanism, square waves of any frequency can be output.
As soon as a match occurs, the TM80 value is cleared to 0 and TM80 continues counting. At the same time, an interrupt
request signal (INTTM80) is generated.
Square wave output is cleared (0) when bit 7 (TCE80) in TMC80 is set to 0.
Table 9-6 shows square wave output range, and Figure 9-6 shows timing of square wave output.
Cautions 1. Before rewriting CR80, stop the timer operation once. If CR80 is rewritten in the timer
operation-enabled state, a match interrupt request signal may occur at the moment of rewrite.
2. If the count clock setting and TM80 operation-enabled are set in TMC80 simultaneously using
an 8-bit memory manipulation instruction, an error of more than one clock in one cycle may
occur after the timer starts.
Therefore, always follow the above procedure when operating the 8-bit timer/event counter
as an interval timer.
Table 9-6. Square Wave Output Range of 8-Bit Timer/Event Counter 80 (At f
X
= 5.0-MHz Operation)
TCL801 TCL800
Minimum Pulse Width
Maximum Pulse Width
Resolution
0
0
1/f
X
(200 ns)
2
8
/f
X
(51.2
µ
s)
1/f
X
(200 ns)
0
1
2
3
/f
X
(1.6
µ
s)
2
11
/f
X
(409.6
µ
s)
2
3
/f
X
(1.6
µ
s)
Remark
f
X
: System clock oscillation frequency (ceramic/crystal oscillation)
Table 9-7. Square Wave Output Range of 8-Bit Timer/Event Counter 80 (At f
CC
= 4.0-MHz Operation)
TCL801 TCL800
Minimum Pulse Width
Maximum Pulse Width
Resolution
0
0
1/f
CC
(250 ns)
2
8
/f
CC
(64
µ
s)
1/f
CC
(250 ns)
0
1
2
3
/f
CC
(2.0
µ
s)
2
11
/f
CC
(512
µ
s)
2
3
/f
CC
(2.0
µ
s)
Remark
f
CC
: System clock oscillation frequency (RC oscillation)
Summary of Contents for mPD789101
Page 2: ...2 User s Manual U13045EJ2V0UM00 MEMO...
Page 10: ...10 User s Manual U13045EJ2V0UM00 MEMO...
Page 16: ...User s Manual U13045EJ2V0UM00 16 MEMO...
Page 46: ...User s Manual U13045EJ2V0UM00 46 MEMO...
Page 72: ...72 User s Manual U13045EJ2V0UM00 MEMO...
Page 86: ...User s Manual U13045EJ2V0UM00 86 MEMO...
Page 94: ...User s Manual U13045EJ2V0UM00 94 MEMO...
Page 102: ...User s Manual U13045EJ2V0UM00 102 MEMO...
Page 128: ...User s Manual U13045EJ2V0UM00 128 MEMO...
Page 148: ...User s Manual U13045EJ2V0UM00 148 MEMO...
Page 162: ...User s Manual U13045EJ2V0UM00 162 MEMO...
Page 218: ...User s Manual U13045EJ2V0UM00 218 MEMO...
Page 238: ...User s Manual U13045EJ2V0UM00 238 MEMO...
Page 240: ...User s Manual U13045EJ2V0UM00 240 MEMO...
Page 256: ...User s Manual U13045EJ2V0UM00 256 MEMO...
Page 258: ...258 User s Manual U13045EJ2V0UM00 MEMO...