CHAPTER 7 TIMER/COUNTER FUNCTION
User’s Manual U13850EJ6V0UD
246
7.4.3 Operation as square wave output (8-bit resolution)
A square wave with any frequency is output at the interval preset by 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 with any frequency (duty factor = 50%) is
possible.
Setting method
(1) Set the registers.
• Set the port latch and port mode register to 0
• TCLn0, TCLn1:
Select 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-34. 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 by the LVSn and LVRn bits of the TMCn register.
Remarks 1.
Square-wave output frequency = 1/2 (N + 1)
2.
n = 2 to 5
Содержание V850/SB1
Страница 2: ...User s Manual U13850EJ6V0UD 2 MEMO ...