Operation As Square Wave Output - NEC mPD789101 User Manual

8-bit single-chip microcontrollers
Table of Contents

Advertisement

9.4.3 Operation as square wave output

The 8-bit timer/event counter can generate output square waves of a given frequency at intervals specified by the
count value set to the 8-bit compare register 80 (CR80) in advance.
To operate the 8-bit timer/event counter 80 for square wave output, the following settings are required.
<1> Set P24 to output mode (PM24 = 0) and the P24 output latch to 0.
<2> Set 8-bit timer register 80 (TM80) to operation disable (TCE80 = 0).
<3> Set the count clock of the 8-bit timer/event counter (see Tables 9-4 and 9-5), TO80 to output enable (TOE80
= 1), and PWM output to disable (PWME80 = 0).
<4> Set the count value to CR80.
<5> Set TM80 to operation enable (TCE80 = 1).
When the count value of 8-bit timer register 80 (TM80) matches the value set in CR80, the TO80/P24/INTP1/TO20
pin output will be inverted. Through application of this mechanism, square waves of any frequency can be output.
As soon as a match occurs, the TM80 value is cleared to 0 and TM80 continues counting. At the same time, an interrupt
request signal (INTTM80) is generated.
Square wave output is cleared (0) when bit 7 (TCE80) in TMC80 is set to 0.
Table 9-6 shows square wave output range, and Figure 9-6 shows timing of square wave output.
Cautions 1. Before rewriting CR80, stop the timer operation once. If CR80 is rewritten in the timer
operation-enabled state, a match interrupt request signal may occur at the moment of rewrite.
2. If the count clock setting and TM80 operation-enabled are set in TMC80 simultaneously using
an 8-bit memory manipulation instruction, an error of more than one clock in one cycle may
occur after the timer starts.
Therefore, always follow the above procedure when operating the 8-bit timer/event counter
as an interval timer.
Table 9-6. Square Wave Output Range of 8-Bit Timer/Event Counter 80 (At f
TCL801 TCL800
0
0
0
1
Remark
f
X
Table 9-7. Square Wave Output Range of 8-Bit Timer/Event Counter 80 (At f
TCL801 TCL800
0
0
0
1
Remark
f
CC
CHAPTER 9 8-BIT TIMER/EVENT COUNTER
Minimum Pulse Width
1/f
(200 ns)
X
(1.6 µ s)
2
3
/f
X
: System clock oscillation frequency (ceramic/crystal oscillation)
Minimum Pulse Width
1/f
(250 ns)
CC
(2.0 µ s)
3
2
/f
CC
: System clock oscillation frequency (RC oscillation)
User's Manual U13045EJ2V0UM00
Maximum Pulse Width
(51.2 µ s)
8
2
/f
1/f
X
X
(409.6 µ s)
2
11
/f
2
3
/f
X
X
Maximum Pulse Width
(64 µ s)
2
8
/f
1/f
CC
CC
(512 µ s)
11
3
2
/f
2
/f
CC
CC
= 5.0-MHz Operation)
X
Resolution
(200 ns)
(1.6 µ s)
= 4.0-MHz Operation)
CC
Resolution
(250 ns)
(2.0 µ s)
123

Advertisement

Table of Contents
loading

Table of Contents