FACT001: Basic PIC16/17 Oscillator Design
FACT001: Basic PIC16/17 Oscillator Design
Gain of inverter/amplifier is
based on selected Clock mode.
The oscillator circuit is one of the most overlooked Clock Modes:
areas of microprocessor circuit design. Components LP - lowest gain
are usually selected based on the manufacturers XT - higher gain
tables. If the circuit starts up and works, fine, no other HS - highest gain
thought need be given to it, right? Wrong. Many condi- RF
OSC1 OSC2
tions can negatively affect the performance of your
design. Higher temperatures and lower supply voltages Crystal Rs
can lower the loop gain in the oscillator circuit, causing
poor, slow, or no start-up. Colder temperatures and
higher supply voltages can increase the loop gain of C1 C2
the oscillator circuit, causing the crystal to be over-
driven, and potentially damaged; or the circuit can be
forced to another harmonic and throw off the timing, or
cease functioning altogether. It is also possible to Purpose of Components and Clock
waste power through the improper selection of compo- Modes
nents or Clock modes.
A good place to begin is with the purpose of each exter-
Most of the time, using the values given in the manu- nal component. Because this is a loop circuit, a change
facturers data book tables will work fine. However, in one component can change the affect of other com-
most manufacturers processors run in a limited voltage ponents in the circuit. Therefore, a strict definition of
range and across a limited frequency, so table values purpose is a simplification for clarity only.
can be given for C1 and C2 with little concern for the
The crystal has its lowest impedance near the desired
designers environment. Microchip parts, however, can
frequency. This is placed in the path between the out-
be asked to run with clocks from 0 to 25 MHz, supply
put and the input of the inverting amplifier. This permits
voltages from 2.0 VDC to 6.25 VDC, and temperatures
feedback, and therefore, oscillation, which occurs at
from -40C to +125C, depending on the part and ver-
the desired resonant frequency.
sion ordered. This must also be done with crystals of
varying quality and manufacture. These factors create The diagrams shown below illustrate an equivalent
many chances for exceptions to the values given in the circuit for a crystal (Figure 2), and the impedance/
data book. reactance versus frequency of the crystal (Figure 3).
Cc represents the case capacitance across the termi-
Function of the Oscillator Circuit nals of the crystal. R, Cp, and Lp are known as the
motional arm of the crystal. In Parallel Resonant mode
The circuit (Figure 1) is a typical Pierce parallel (Anti-resonance), the crystal will look inductive to the
resonant oscillator circuit, as used with the Microchip circuit. The impedance will reach its peak at fa. The
PIC16/17 family of devices. The output of an inverting load capacity should be selected to operate the crystal
amplifier is fed back to its input creating an "unstable" at a stable point on the fs-fa reactive curve (as close to
loop. When the inverter output is high and fed back to fs as possible).
the input, output goes low, reversing the process. Sta-
ble oscillation is achieved when the circuit components
attached achieve this feedback with "unity gain" only at Note: Even parallel resonant crystals have a
the desired frequency. series resonant frequency fs.
Selection of Components
Cc There are several factors that go into the selection and
arrangement of these external components. Some of
these are amplifier gain, desired frequency and the res-
FIGURE 3: IMPEDANCE/REACTANCE VS. onant frequency(s) of the crystal, temperature of oper-
ation, supply voltage and its range, start-up time,
CRYSTAL FREQUENCY
stability, crystal life, power consumption, simplification
Area of usual Anti-resonance of the circuit and use of standard components (as few
+ parallel resonance Fe as possible). To say that there are a lot of factors, and
that there are trade-offs with each, is an understate-
ment.
Series
Impedance
The PICmicro family meets the specifications contained in the Microchip Data Sheet.
Microchip believes that its family of PICmicro microcontrollers is one of the most secure products of its kind on the market today,
when used in the intended manner and under normal conditions.
There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our knowl-
edge, require using the PICmicro microcontroller in a manner outside the operating specifications contained in the data sheet.
The person doing so may be engaged in theft of intellectual property.
Microchip is willing to work with the customer who is concerned about the integrity of their code.
Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not
mean that we are guaranteeing the product as unbreakable.
Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of
our product.
If you have any further questions about this matter, please contact the local sales office nearest to you.
03/01/02