C8051T620/1/6/7 & C8051T320/1/2/3
134
Rev. 1.2
21.6. External Oscillator Drive Circuit
The external oscillator circuit may drive an external crystal, ceramic resonator, capacitor, or RC network. A
CMOS clock may also provide a clock input. Figure 21.1 shows a block diagram of the four external oscil-
lator options. The external oscillator is enabled and configured using the OSCXCN register (see SFR Defi-
nition 21.6).
Important Note on External Oscillator Usage:
Port pins must be configured when using the external
oscillator circuit. When the external oscillator drive circuit is enabled in crystal/resonator mode, Port pins
P0.2 and P0.3 are used as XTAL1 and XTAL2, respectively. When the external oscillator drive circuit is
enabled in capacitor, RC, or CMOS clock mode, Port pin P0.3 is used as XTAL2. The Port I/O Crossbar
should be configured to skip the Port pin used by the oscillator circuit; see Section “22.3. Priority Crossbar
Decoder” on page 142 for Crossbar configuration. Additionally, when using the external oscillator circuit in
crystal/resonator, capacitor, or RC mode, the associated Port pins should be configured as
analog inputs
.
In CMOS clock mode, the associated pin should be configured as a
digital input
I/O Initialization” on page 146 for details on Port input mode selection.
The external oscillator output may be selected as the system clock or used to clock some of the digital
peripherals (e.g. Timers, PCA, etc.). See the data sheet chapters for each digital peripheral for details. See
Section “7. Electrical Characteristics” on page 34 for complete oscillator specifications.
21.6.1. External Crystal Mode
If a crystal or ceramic resonator is used as the external oscillator, the crystal/resonator and a 10 M
resis-
tor must be wired across the XTAL1 and XTAL2 pins as shown in Figure 21.1, “Crystal Mode”. Appropriate
loading capacitors should be added to XTAL1 and XTAL2, and both pins should be configured for analog
I/O with the digital output drivers disabled.
The capacitors shown in the external crystal configuration provide the load capacitance required by the
crystal for correct oscillation. These capacitors are “in series” as seen by the crystal and “in parallel” with
the stray capacitance of the XTAL1 and XTAL2 pins.
Note:
The recommended load capacitance depends upon the crystal and the manufacturer. Please refer to
the crystal data sheet when completing these calculations.
The equation for determining the load capacitance for two capacitors is
Where:
C
A
and C
B
are the capacitors connected to the crystal leads.
C
S
is the total stray capacitance of the PCB.
The stray capacitance for a typical layout where the crystal is as close as possible to the pins is 2-5 pF per
pin.
If C
A
and C
B
are the same (C), then the equation becomes
For example, a tuning-fork crystal of 32 kHz with a recommended load capacitance of 12.5 pF should use
the configuration shown in Figure 21.1, Option 1. With a stray capacitance of 3 pF per pin (6 pF total), the
13 pF capacitors yield an equivalent capacitance of 12.5 pF across the crystal, as shown in Figure 21.2.
C
L
C
A
C
B
C
A
C
B
+
--------------------
C
S
+
=
C
L
C
2
----
C
S
+
=