Square-Wave Output Operation - NEC mPD780344 Series User Manual

8-bit single-chip microcontrollers
Table of Contents

Advertisement

8.5.3 Square-wave output operation

A square wave with any selected frequency is output at intervals determined according to the value preset to 8-
bit timer compare register 5n (CR5n).
The TO5n pin output status is reversed at intervals determined according to 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.
• Set port latches (P32, P33)
• TCL5n: Select count clock
• CR5n:
Compare value
• TMC5n: Counter operation stops, clear and start mode by match of TM5n and CR5n
<2> After TCE5n = 1 is set, count operation starts.
<3> Timer output F/F is reversed by match of TM5n and CR5n. After INTTM5n is generated, TM5n is cleared
to 00H.
<4> Timer output F/F is reversed at the same interval and square wave is output from TO5n.
The frequency is as follows.
Frequency = f
CNT
(N: 00H to FFH, f
Note 8-bit timer/event counter 50: P33, PM33
8-bit timer/event counter 51: P32, PM32
Count clock
TMn count value
00H
Count start
CR5n
Note
TO5n
Note The TO5n output initial value can be set by bits 2 and 3 (LVR5n, LVS5n) of 8-bit timer mode control register
5n (TMC5n).
Remark n = 0, 1
CHAPTER 8 8-BIT TIMER/EVENT COUNTERS 50, 51
Note
and port mode registers (PM32, PM33)
LVS5n
LVR5n
Timer Output F/F Status Setting
1
0
High-level output
0
1
Low-level output
Timer output F/F reverse enable
Timer output enable → TOE5n = 1
(TMC5n = 00001011B or 00000111B)
/2 (N + 1)
: count clock)
CNT
Figure 8-9. Square-Wave Output Operation Timing
01H
02H
N – 1
N
User's Manual U15798EJ2V0UD
Note
N
00H
01H
02H
to 0.
N – 1
N
00H
199

Advertisement

Table of Contents
loading

Table of Contents