CHAPTER 7 TIMER/COUNTER FUNCTION
User’s Manual U13850EJ4V0UM
222
7.4.3 Operation as square wave output (8-bit resolution)
A square wave having any frequency is output at the interval preset in 8-bit compare register n (CRn0).
By setting bit 0 (TOEn) of 8-bit timer mode control register n (TMCn) to 1, the output state of TOn is inverted with
the count preset in CRn0 as the interval. Therefore, a square wave output having any frequency (duty factor = 50%)
is possible.
Setting method
(1) Set the registers.
• Sets the port latch and port mode register to 0
• TCLn0, TCLn1: Selects the count clock
• CRn0:
Compare value
• TMCn:
Clear and start mode when TMn and CRn0 match
LVSn
LVRn
Setting State of Timer Output Flip-Flop
1
0
High level output
0
1
Low level output
Inversion of timer output flip-flop enabled
Timer output enabled
→
TOEn = 1
(2) When TCEn = 1 is set, the counter starts operating.
(3) If the values of TMn and CRn0 match, the timer output flip-flop inverts. Also, INTTMn is generated and
TMn is cleared to 00H.
(4) Then, the timer output flip-flop is inverted at the same interval to output a square wave from TOn.
Remark
n = 2 to 5
Figure 7-43. Square Wave Output Operation Timing
00H
00H
01H
02H
N
−
1
N
01H
02H
N
N
−
1
N
00H
Count clock
CRn0
TOn
TMn count value
Count start
Note
The initial value of TOn output can be set with TMCn register bits 3 and 2 (LVSn, LVRn).
Remark
n = 2 to 5
Содержание MPD703030A
Страница 2: ...User s Manual U13850EJ4V0UM 2 MEMO ...
Страница 514: ...User s Manual U13850EJ4V0UM 514 MEMO ...