Square Wave Output Operation (8-Bit Resolution) (Timers 50 To 52) - NEC mPD178054 Series User Manual

8-bit single-chip microcontrollers
Table of Contents

Advertisement

6.4.3 Square wave output operation (8-bit resolution) (timers 50 to 52)

8-bit timer/event counter TM5n can be used to output a square wave with any frequency at time interval specified
by the value set in advance in 8-bit compare register 5n (CR5n).
When bit 0 (TOE5n) of 8-bit timer mode control register 5n (TMC5n) is set to 1, the output status of TO5n is inverted
at the interval specified by the count value set in advance to CR5n. In this way, a square wave (duty factor = 50%)
of any frequency can be output.
[Setting]
<1> Set each register.
• Reset the port latch and port mode register to "0".
• TCL5n:
Select a count clock.
• CR5n:
Compare value
• TMC5n: Mode in which TM5n is cleared and started on match between TM5n and CR5n
LVS5n LVR5n
1
0
Enable inverting the timer F/F.
Enable the timer output → TOE5n = 1.
<2> When TCE5n is set to 1, the count operation is started.
<3> When the value of TM5n matches the value of CR5n, the timer output F/F is inverted.
In addition, INTTM5n is generated, and TM5n is cleared to 00H.
<4> After that, the timer output F/F is inverted at fixed intervals, and a square wave is output from TO5n.
Remark n = 0 to 2
Count clock
TM5n count value
00H
Count starts
CR5n
INTTM5n
Note
TO5n
Note
The initial value of the TO5n output can be set using bits 2 and 3 (LVR5n and LVS5n) of 8-bit timer mode
control register 5n (TMC5n).
Remark n = 0 to 2
110
CHAPTER 6 8-BIT TIMER/EVENT COUNTERS 50 TO 53
Sets Status of Timer Output F/F
0
High-level output
1
Low-level output
Figure 6-11. Timing of Square Output Operation
01H
02H
N – 1
N
User's Manual U15104EJ2V0UD
N
00H
01H
02H
N – 1
N
00H

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mpd178053Mpd178054Mpd178f054

Table of Contents