CHAPTER 7 8-BIT TIMER/EVENT COUNTER 50
Preliminary User’s Manual U16846EJ1V0UD
151
7.4.3 Operation as square-wave output
A square wave with any selected frequency is output at intervals determined by the value preset to 8-bit timer
compare register 50 (CR50).
The TO50 pin output status is inverted at intervals determined by the count value preset to CR50 by setting bit 0
(TOE50) of 8-bit timer mode control register 50 (TMC50) to 1. This enables a square wave with any selected
frequency to be output (duty = 50%).
Setting
<1> Set each register.
•
Set the port output latch (P17) and port mode register 1 (PM17) to 0.
•
TCL50: Select the count clock.
•
CR50: Compare
value
•
TMC50: Stop the count operation, select clear & start mode entered on a match of TM50 and CR50.
LVS50
LVR50
Timer Output F/F Status Setting
1 0
High-level
output
0 1
Low-level
output
Timer output F/F inversion enabled
Timer output enabled
(TMC50 = 00001011B or 00000111B)
<2> After TCE50 = 1 is set, the count operation starts.
<3> The timer output F/F is inverted by a match of TM50 and CR50. After INTTM50 is generated, TM50 is
cleared to 00H.
<4> After these settings, the timer output F/F is inverted at the same interval and a square wave is output from
TO50.
The frequency is as follows.
Frequency = 1/2t (N + 1)
(N: 00H to FFH)
Caution Do not write other values to CR50 during operation.
Figure 7-9. Square-Wave Output Operation Timing
Count clock
TM50 count value
00H
01H
02H
N
−
1
N
N
00H
N
−
1
N
00H
01H
02H
CR50
TO50
Note
t
Count start
Note The initial value of TO50 output can be set by bits 2 and 3 (LVR50, LVS50) of 8-bit timer mode control
register 50 (TMC50).