![background image](http://html1.mh-extra.com/html/nec/mpd780344-series/mpd780344-series_user-manual_4071564172.webp)
172
CHAPTER 7 8-BIT TIMERS A0, B0
User’s Manual U15798EJ2V0UD
(3) Operation as square-wave output with 8-bit resolution
Square waves of any frequency can be output at an interval specified by the value preset in 8-bit compare register
n0 (CRn0).
To operate timer n0 for square-wave output, settings must be made in the following sequence.
<1>
Disable operation of 8-bit timer counter n0 (TMn0) (TCEn0 = 0).
<2>
Disable timer output of TOn0 (TOEn0 = 0).
<3>
Set the count clock for timer n0 (see
Table 7-5
).
<4>
Set the operation mode of timer n0 to 8-bit timer counter mode (see
Figures 7-4
and
7-5
).
<5>
Set a count value in CRn0.
<6>
Enable output of TOn0 (TOEn0 = 1).
<7>
In the case of timer A0, set P07 to output mode (PM07 = 0).
In the case of timer B0, set P06 to output mode (PM06 = 0).
<8>
In the case of timer A0, set the output latches of P07 to 0.
In the case of timer B0, set the output latches of P06 to 0.
<9>
Enable the operation of TMn0 (TCEn0 = 1).
When the count value of TMn0 matches the value set in CRn0, the TOn0 pin output status will be inverted. Through
application of this mechanism, square waves of any frequency can be output. As soon as a match occurs, TMn0
is cleared to 00H and continues counting. At the same time, an interrupt request signal (INTTMn0) is generated.
The square-wave output is cleared to 0 by setting TCEn0 to 0.
Table 7-5 shows the square-wave output range, and Figure 7-15 shows the timing of square-wave output.
Caution Be sure to stop the timer operation before overwriting the count clock with different data.
Remark
n = A, B
Table 7-5. Square-Wave Output Range of Timer B0
TCLB02
TCLB01
TCLB00
Minimum Pulse Width
Maximum Pulse Width
Resolution
0
0
0
2
2
/f
X
(0.4
µ
s)
2
10
/f
X
(102 ms)
2
2
/f
X
(0.4
µ
s)
0
0
1
2
3
/f
X
(0.8
µ
s)
2
11
/f
X
(205 ms)
2
3
/f
X
(0.8
µ
s)
0
1
0
f
TMI
input cycle
f
TMI
input cycle
×
2
8
f
TMI
input cycle
0
1
1
f
TMI
/2 input cycle
f
TMI
/2 input cycle
×
2
8
f
TMI
/2 input cycle
1
0
0
f
TMI
/2
2
input cycle
f
TMI
/2
2
input cycle
×
2
8
f
TMI
/2
2
input cycle
1
0
1
f
TMI
/2
3
input cycle
f
TMI
/2
3
input cycle
×
2
8
f
TMI
/2
3
input cycle
Remarks 1.
f
X
: Main system clock oscillation frequency
2.
f
TMI
: Input frequency from TMIB0 pin
3.
The parenthesized values apply to operation at f
X
= 10.0 MHz
Содержание mPD780344 Series
Страница 2: ...2 User s Manual U15798EJ2V0UD MEMO...