
CHAPTER 7 8-BIT TIMER/EVENT COUNTERS 50 AND 51
User’s Manual U19780EJ2V0UD
253
7.4.3 Square-wave output operation
A square wave with any selected frequency is output at intervals determined by the value preset to 8-bit timer
compare register 5n (CR5n).
The TO5n pin output status is inverted at intervals determined by the count value preset to CR5n by setting bit 0
(TOE5n) of 8-bit timer mode control register 5n (TMC5n) to 1. This enables a square wave with any selected
frequency to be output (duty = 50%).
Setting
<1> Set each register.
•
Clear the port output latch (P10, P11, P33, P34)
Note
and port mode register (PM10, PM11, PM33, PM34)
Note
to 0.
•
TCL5n: Select the count clock.
•
CR5n: Compare
value
•
TMC5n: Stop the count operation, select the mode in which clear & start occurs on a match of TM5n and
CR5n.
LVS5n
LVR5n
Timer Output F/F Status Setting
0
1
Timer output F/F clear (0) (default value of TO5n output: low level)
1
0
Timer output F/F set (1) (default value of TO5n output: high level)
Timer output enabled
(TMC5n = 00001011B or 00000111B)
<2> After TCE5n = 1 is set, the count operation starts.
<3> The timer output F/F is inverted by a match of TM5n and CR5n. After INTTM5n is generated, TM5n 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
TO5n.
The frequency is as follows.
•
Frequency = 1/2t (N + 1)
(N: 00H to FFH)
Note
8-bit timer/event counter 50: P11, PM11 (In case of 78K0/KB2-A)
P34, PM34 (In case of 78K0/KC2-A)
8-bit timer/event counter 51: P10, PM10 (In case of 78K0/KB2-A))
P33, PM33 (In case of 78K0/KC2-A)
Caution Do not write other values to CR5n during operation.
Remarks 1.
For how to enable the INTTM5n signal interrupt, see
CHAPTER 18 INTERRUPT FUNCTIONS
.
2.
n = 0, 1