110
CHAPTER 6 8-BIT TIMER/EVENT COUNTERS 50 TO 53
User’s Manual U15104EJ2V0UD
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
Sets Status of Timer Output F/F
1
0
High-level output
0
1
Low-level output
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
Figure 6-11. Timing of Square Output Operation
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
Count clock
TM5n count value
00H
Count starts
01H
02H
N – 1
N
N
00H
N – 1
N
00H
01H
02H
CR5n
INTTM5n
TO5n
Note
Содержание mPD178053
Страница 2: ...2 User s Manual U15104EJ2V0UD MEMO ...