218
CHAPTER 9 8-BIT TIMER/EVENT COUNTER
(3) Operation as square wave output
The 8-bit timers/event counters operate square wave output of any frequency at time intervals specified by
the values set to the corresponding 8-bit compare registers (CR10 and CR20) in advance. When setting a
count value, write the value of the high-order 8 bits to CR20 and the value of the low-order 8 bits to CR10.
When the bit 4 (TOE2) of the 8-bit timer output control register (TOC1) is set to 1, the output status of the
TO2/P32 pin is inverted at time intervals specified by the count values set to CR10 or CR20 in advance. In
this way, square waves of any frequency can be output.
Table 9-10. Square Wave Output Range when Two 8-Bit Timer/Event Counters (TM1 and TM2)
Are Used as One 16-Bit Timer/Event Counter
TCL13
TCL12
TCL11
TCL10
Minimum Pulse Width
Maximum Pulse Width
Resolution
0
1
1
0
2
2
×
1/f
X
(400 ns)
2
18
×
1/f
X
(26.2 ms)
2
2
×
1/f
X
(400 ns)
0
1
1
1
2
3
×
1/f
X
(800 ns)
2
19
×
1/f
X
(52.4 ms)
2
3
×
1/f
X
(800 ns)
1
0
0
0
2
4
×
1/f
X
(1.6
μ
s)
2
20
×
1/f
X
(104.9 ms)
2
4
×
1/f
X
(1.6
μ
s)
1
0
0
1
2
5
×
1/f
X
(3.2
μ
s)
2
21
×
1/f
X
(209.7 ms)
2
5
×
1/f
X
(3.2
μ
s)
1
0
1
0
2
6
×
1/f
X
(6.4
μ
s)
2
22
×
1/f
X
(419.4 ms)
2
6
×
1/f
X
(6.4
μ
s)
1
0
1
1
2
7
×
1/f
X
(12.8
μ
s)
2
23
×
1/f
X
(838.9 ms)
2
7
×
1/f
X
(12.8
μ
s)
1
1
0
0
2
8
×
1/f
X
(25.6
μ
s)
2
24
×
1/f
X
(1.7 s)
2
8
×
1/f
X
(25.6
μ
s)
1
1
0
1
2
9
×
1/f
X
(51.2
μ
s)
2
25
×
1/f
X
(3.4 s)
2
9
×
1/f
X
(51.2
μ
s)
1
1
1
0
2
10
×
1/f
X
(102.4
μ
s)
2
26
×
1/f
X
(6.7 s)
2
10
×
1/f
X
(102.4
μ
s)
1
1
1
1
2
12
×
1/f
X
(409.6
μ
s)
2
28
×
1/f
X
(26.8 s)
2
12
×
1/f
X
(409.6
μ
s)
Remarks
1.
f
X
: Main system clock oscillation frequency
2.
TCL10-TCL13: Bits 0 through 3 of timer clock select register 1 (TCL1)
3.
( ): At f
X
= 10.0 MHz operation
Figure 9-13. Square Wave Output Timing
Count
clock
TM1
TM2
CR10
CR20
TO2
00H
01H
01H
FFH 00H
FFH 00H
FFH 00H
01H
N
00H
00H
01H
02H
M
–
1 M
00H
N+1
N
N
M
Interval time
Count starts
Level inversion
Counter cleared