179
CHAPTER 7 8-BIT TIMERS A0, B0
User’s Manual U15798EJ2V0UD
(3) Operation as square-wave output with 16-bit resolution
Square waves of any frequency can be output at an interval specified by the count value preset in CRA0 and
CRB0.
To operate as a square-wave output with 16-bit resolution, settings must be made in the following sequence.
<1>
Disable operation of 8-bit timer counter A0 (TMA0) and 8-bit timer counter B0 (TMB0) (TCEA0 = 0,
TCEB0 = 0).
<2>
Disable timer output of TOA0 and TOB0 (TOEA0 = 0, TOEB0 = 0).
<3>
Set a count clock for timer B0.
<4>
Set the operation mode of timer A0 and timer B0 to 16-bit timer counter mode (see
Figures 7-4
and
7-
5
).
<5>
Set count values in CRA0 and CRB0.
<6>
Set P06 to output mode (PM06 = 0) and P06 output latch to 0 and enable TOB0 output (TOEB0 = 1) (TOA0
cannot be used).
<7>
Enable the operation of TMB0 (TCEB0 = 1
Note
).
Note
Start and clear of the timer in the 16-bit timer counter mode are controlled by TCEB0 (the value of TCEA0
is invalid).
When the count values of TMA0 and TMB0 simultaneously match the values set in CRA0 and CRB0 respectively,
the TOB0 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, TMA0 and TMB0 are cleared to 00H and counting continues.
At the same time, an interrupt request signal (INTTMB0) is generated (INTTMA0 is not generated).
The square-wave output is cleared to 0 by setting TCEB0 to 0.
Table 7-7 shows the square-wave output range, and Figure 7-18 shows timing of square-wave output.
Cautions 1. Be sure to stop the timer operation before overwriting the count clock with different data.
2. In the 16-bit timer counter mode, TOA0 cannot be used. Be sure to set TOEA0 = 0 to disable
TOA0 output.
Table 7-7. Square-Wave Output Range with 16-Bit Resolution
TCLB02
TCLB01
TCLB00
Minimum Interval Time
Maximum Interval Time
Resolution
0
0
0
2
2
/f
X
(0.4
µ
s)
2
18
/f
X
(26.2 ms)
2
2
/f
X
(0.4
µ
s)
0
0
1
2
3
/f
X
(0.8
µ
s)
2
19
/f
X
(52.4 ms)
2
3
/f
X
(0.8
µ
s)
0
1
0
f
TMI
input cycle
f
TMI
input cycle
×
2
16
f
TMI
input cycle
0
1
1
f
TMI
/2 input cycle
f
TMI
/2 input cycle
×
2
16
f
TMI
/2 input cycle
1
0
0
f
TMI
/2
2
input cycle
f
TMI
/2
2
input cycle
×
2
16
f
TMI
/2
2
input cycle
1
0
1
f
TMI
/2
3
input cycle
f
TMI
/2
3
input cycle
×
2
16
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...