NEC mPD780344 Series User Manual page 179

8-bit single-chip microcontrollers
Table of Contents

Advertisement

(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
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
0
0
0
0
0
1
0
1
0
0
1
1
1
0
0
1
0
1
Remarks 1. f
: Main system clock oscillation frequency
X
2. f
: Input frequency from TMIB0 pin
TMI
3. The parenthesized values apply to operation at f
CHAPTER 7 8-BIT TIMERS A0, B0
Note
).
Minimum Interval Time
2
(0.4 µ s)
2
/f
X
3
(0.8 µ s)
2
/f
X
f
input cycle
TMI
f
/2 input cycle
TMI
2
f
/2
input cycle
TMI
3
f
/2
input cycle
TMI
User's Manual U15798EJ2V0UD
Maximum Interval Time
18
2
/f
(26.2 ms)
X
19
2
/f
(52.4 ms)
X
input cycle × 2
16
f
TMI
/2 input cycle × 2
16
f
TMI
input cycle × 2
2
16
f
/2
TMI
input cycle × 2
3
16
f
/2
TMI
= 10.0 MHz
X
Resolution
2
(0.4 µ s)
2
/f
X
3
(0.8 µ s)
2
/f
X
f
input cycle
TMI
f
/2 input cycle
TMI
2
f
/2
input cycle
TMI
3
f
/2
input cycle
TMI
179

Advertisement

Table of Contents
loading

Table of Contents