Operation As Square-Wave Output (Timer 01 Only); Square-Wave Output Range Of 8-Bit Timer/Event Counter 01 - NEC switch User Manual

Nec user's manua switch
Table of Contents

Advertisement

6.4.3 Operation as square-wave output (timer 01 only)

The 8-bit timer/event counter can generate output square waves of arbitrary frequency at intervals specified by
the count value set to 8-bit compare register 01 (CR01) in advance.
To operate 8-bit timer/event counter 01 as square wave output, the following settings are required.
<1> Set P26 to output mode (PM26 = 0) and the output latch of P26 to 0.
<2> Disable operation of 8-bit timer counter 01 (TM01) by setting TCE01 (bit 7 of 8-bit timer mode control
register 01 (TMC01)) to 0.
<3> Set the count clock of 8-bit timer/event counter 01 (see Table 6-7) and enable output of TO01 by setting
TOE01 (bit 0 of TMC01) to 1
<4> Set count values to CR01.
<5> Enable operation of TM01 by setting TCE01 to 1.
When the count value of 8-bit timer counter 01 (TM01) matches the value set to CR01, the TO01/P26/INTP0/TI01
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 TM01 value is cleared to 0, TM01 resumes counting, and an interrupt request signal
(INTTM01 is generated).
Setting bit 7 of TMC01 (TCE01) to 0 clears the square-wave output to 0.
Table 6-7 lists the square wave output range, and Figure 6-9 shows timing of square wave output.
Caution
When the TMC01 count clock is set and the operation of TM01 is enabled simultaneously by an
8-bit memory manipulation instruction, an error of more than 1 clock may occur in 1 cycle after
the timer has been started. Therefore, be sure to follow the settings above when the 8-bit
timer/event counter is operating as square-wave output.
Table 6-7. Square-Wave Output Range of 8-Bit Timer/Event Counter 01
TCL011
TCL010
0
0
0
1
Remarks 1. f
: System clock oscillation frequency
X
2. The parenthesized values apply to operation at f
88
CHAPTER 6
8-BIT TIMER/EVENT COUNTERS 00 AND 01
Minimum Pulse Width
(2.67 µ s)
4
2
/f
X
(42.7 µ s)
8
2
/f
X
User's Manual U12978EJ3V0UD
Maximum Pulse Width
(682.7 µ s)
12
2
/f
X
16
2
/f
(10.9 ms)
X
= 6.0 MHz.
X
Resolution
(2.67 µ s)
4
2
/f
X
(42.7 µ s)
8
2
/f
X

Advertisement

Table of Contents
loading

Table of Contents