Operation As Square Wave Output (8-Bit Resolution); Square Wave Output Operation Timing - NEC V850/SB1 User Manual

32-bit single-chip microcontroller
Table of Contents

Advertisement

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:
• TMCn:
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
Count clock
TMn count value
Count start
CRn0
TOn
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
246
CHAPTER 7
TIMER/COUNTER FUNCTION
Compare value
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
Figure 7-34. Square Wave Output Operation Timing
N − 1
00H
01H
02H
N
User's Manual U13850EJ6V0UD
N
00H
01H
02H
N − 1
N
00H

Advertisement

Table of Contents
loading

This manual is also suitable for:

V850/sb2

Table of Contents