Operating As Square Wave Output (8-Bit Resolution) - NEC V850/SA1 mPD703015 Preliminary User's Manual

32-/16-bit single-chip microcontrollers
Table of Contents

Advertisement

Figure 7-39. Timing of External Event Counter Operation (when rising edge is set)
TIn
TMn count
0000
value
CRn0
INTTMn
Remark
n = 2 to 5

7.4.3 Operating as square wave output (8-bit resolution)

A square wave having any frequency is output at the interval preset in the 8-bit compare register n (CRn0).
By setting bit (TOEn) 0 of the 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 cycle =
50%) is possible.
Setting method
(1) Set the registers.
• Set the port latch and port mode register to "0."
• TCLn
: Select the count clock.
• CRn0
: Compare value
• TMCn
: Clear and start mode when TMn and CRn0 match.
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 for the same interval to output a square wave from TOn.
188
CHAPTER 7
TIMER/COUNTER FUNCTION
0001
0002
0003
0004
0005
LVSn
LVRn
Setting State of Timer Output Flip-flop
1
0
High level output
0
1
Low level output
N−1
N
0000
0001
0002
N
0003

Advertisement

Table of Contents
loading

Table of Contents