Oscillators

Photo by Harrison Broadbent / Unsplash

For a precision clock source being the heart of every computer, we didn't really bother with custom oscillators. We didn't have to - all the processors we used had a built-in oscillator, and all we had to do was connect a crystal and load capacitance. The load capacitance most often takes the form of one or two capacitors with a capacity between 22 and 48 pF, and if you don't know exactly which one to use, you look in the datasheet for the processor, and it's usually described there.

The important thing is just to follow the "large ground area around the crystal" rule. At the frequencies we use, capacitances, including parasitic ones like the PCB capacitance, are not significantly critical. For faster circuits this would be a problem, but around 2 - 4 MHz, where we are, there is no need to calculate exactly the capacitance of the circuit board, just follow the rules „large ground area around the crystal“ and „do not pull the signal wires close“.

If you delve deeper into the theory of crystal oscillators, you will find that there are several possible circuits and that there are two basic types: parallel and series. Crystals can oscillate at two basic frequencies, which, not to be confused, are also called serial and parallel. Serial is slightly lower than parallel.

In general, a crystal behaves like the component whose impedance (resistance) is lowest when an alternating current with a resonant frequency equal to its mechanical properties passes through it. The impedance of the crystal is zero at two points, the resonance point (series frequency) and the antiresonance point (ideal parallel frequency).

For the crystals we use, i.e., with frequencies in the order of units of megahertz, it is usually not necessary to deal with the exact difference between the series and parallel frequencies. Similarly, for an 8-bit hobbyist computer, there is not much need to deal with temperature compensation and similar things that very precise clock designers have to deal with.

If you're going to build a separate crystal oscillator for digital devices, you'll probably choose a circuit with inverters. After all, even in those microprocessors that have „built-in clock generator&#8220the same circuitry is used. With one (parallel) or two (series) inverters you create the first part of the oscillator, namely the amplifier. The second part of the oscillator, the feedback, is taken care of by the crystal.

Serial circuit

The first circuit, serial, uses two TTL LS/ALS inverters, between which is connected a coupling capacitor C1 (sometimes omitted) with a capacitance of units or tens of nF. Its function is to filter out DC current. Both inverters have feedback resistors connected to keep them in the linear gain region. Their value is not critical, around 2k2 is recommended for frequencies 1-4 MHz. Other sources recommend calculating R2 as 3000/f, where f is the frequency in MHz.

The C2 capacitor is the aforementioned load capacitor - most crystals for our frequencies count on a load capacitance between 22 - 33 pF, but as I wrote: the value is not quite critical.

I better mention it explicitly: when I write that "the value is not critical", I mean that it is not critical for the considered application, i.e. a oscillation generator in the order of units of MHz without claiming high accuracy.

You can still fine tune the frequency of the whole circuit using the C3 trimmer, but if you don't need high accuracy, you can skip the trimmer.

Parallel wiring

The parallel oscillator uses only one single TTL LS/ALS inverter.

Resistors R1, R2 and capacitor C4 act as feedback to keep the inverter in the linear gain region. R1 and R2 have a resistance of 1k, capacitor C4 has a capacitance of about 250 nF.

Load capacitors C1 and C2 again have a capacitance of 22 - 33 pF, trimmer C3 tunes the frequency, not necessary.

If you build this oscillator and use a 74HC04, 74HCT04, or other CMOS gate, you'll find that you won't even oscillate. The oscillator just won't run and won't oscillate.

You may see somewhere that this is because CMOS circuits are too fast, but that's not the real reason. They are actually not significantly faster than TTL LS. The real reason is that they have higher gain and huge input resistance. This means that in the above circuit it is very hard to keep them in the linear region.

CMOS oscillator

Therefore, a modified circuit is used with a resistor in series with the crystal.

Resistor R1, which keeps the inverter in working range, can be on the order of hundreds of kiloohms. Typically a value of 180 k is used, which is more than sufficient for CMOS inverters. But you can use almost anything from 47 k to 1 M.

The C3 tuning trimmer is again used for fine tuning, or omitted. Resistor R2 then limits the current through the crystal, but it also forms a low pass filter along with capacitor C2, which prevents the crystal from oscillating at higher harmonic frequencies.

If you use a TTL LS/ALS gate in this circuit, such as the 74LS04, it will also not oscillate. The very large resistance in the feedback cannot keep it in the working region.

The output of oscillators is usually not used directly. Although the inverters are digital components, in these circuits we make them into little analog amplifiers and force them to work in the forbidden band regions. In addition, capacitors distort the steepness of the edges. So it is usually a good practice to connect another inverter to the output (not necessarily with a Schmitt circuit, but if you have one, use it) to treat the edge steepness, boost the output, and separate it from the rest of the circuit.

For further study:

Comments powered by Talkyard.

Martin Maly

Martin Maly

Programmer, journalist, writer and electronic hobbyist. Vintage CPU lover. Creating new computers with the spirit of 80's.
Czechia