Types of Oscillator Used in Microcontrollers

In this article, we will discuss the oscillator of a microcontroller. Consider a PIC microtroller. It is a mid-range MCU family that uses an internal circuit for generating clock pulses for the microcontroller to work. This is an oscillator. An oscillator circuit helps in executing the instructions and peripherals of the function. For generating the one internal instruction, four clock (TCY) periods are used. The internal oscillator might have up to eight different modes. There are two modes, which allow the RC internal oscillator clock out (CLKOUT) to drive the I/O pins, or these modes allow the I/O pin to derive the general purpose instruction. The selection of these modes is based on device configuration bits. These bits are non-volatile memory locations. Their mode of operation is determined by the value written during the programming of the device.

Oscillator’s Mode of Operation

The oscillator has the following modes of operation:

  1. RC (External Resistor)
  2. HS (High-speed crystal or Resonator)
  3. LP (Low-frequency Power crystal)
  4. XT (CResonator)
  5. INTRC (Internal resistor at 4MHz frequency or capacitor with CLKOUT)
  6. INTRC (Internal resistor at 4MHz frequency or capacitor)
  7. EXTRC (Internal resistor or capacitor)
  8. EXTRC (Internal resistor or capacitor with CLKOUT)

The above modes or options of operation are present in a single device, and flexibility is available to fit the applications with different requirements of the oscillator. The RC option of the oscillator saves money, while the LP crystal option saves power. For selecting the different options, we use bit configuration.

Types of Oscillators

The MID-Range devices have up to eight different oscillator modes. The user uses only three bits of the configuration device (FOSC2, FOSC1, and FOSC0) to select one of these eight (LP, KT, HS, RC, EXTRC, EXTRC, INTRC, INTRC). The difference between modes KT, LP, and HS is to select the different frequency ranges of the internal oscillator. For example, the configuration bits 1 0 in HS mode are for high gain, and the configuration bit 0 1 in HT mode is for medium gain; similarly, the configuration bits 0 0 in LP mode are for low gain.

 Crystal Oscillators or Ceramic Resonators

The crystal oscillators or ceramic resonators connect with the pins OSCI and OSC2 in LP, XT, or HS modes to establish the oscillation. A parallel-cut crystal is present in a PIC micro-oscillator for the design. If we use a series-cut crystal during manufacturing, then it may give a frequency that is out of range. We can see a crystal or ceramic resonator operation circuit in figure 1. It operates in HS, XT, and LP modes.

Crystal Oscillator or Ceramic Resonator Operation Circuit

The circuit has an external clock source to drive the OSC1 pin; we may require series resistance Rs for an AT-cut crystal strip. RF is the feedback resistor, ranging between 2 and 10 MΩ. The buffer for the internal logic may be after or before the inverter oscillator, depending on the device.

Oscillator or Resonator Start Up

The oscillator or resonator will start up with its oscillations when the VCC voltage of the device increases. It’s time to start the oscillation, depending on factors such as the layout of the circuit oscillator, the quality of the crystal, the system temperature, the value of the capacitor, the value of the series resistor, the noise of the system, the VDD rise time of the device, the selection mode of the oscillator, and the resonant frequency. Figure 2 shows the oscillator start-up characteristics.

Start-up Characteristics of Crystal Oscillator

Component Selection for Oscillator

Figure 1 shows the oscillator circuitry, and according to this figure, the value of feedback Rs would be in the range of 2 to 10 MΩ. The value of this resistor varies with the deice voltages, variations in process, and temperature. During the selection of a resistor, we need to keep in mind the operating voltages of the device and its manufacturing process. For component selection, also see the component specification data sheet and typical values of capacitors C1 and C2. Each device data sheet gives the specific values, as we can see in Table 1.

1 Capacitor Selection table of Resonator or oscillator

The values of capacitors C1 and C2 would be according to the above table. The high value of the capacitor increases the stability of the oscillator but also increases the start-up time. The above table values are only useful for design purposes, but each oscillator or resonator has its own characteristics. All the resonators must have an external capacitor.

How to Select Internal Oscillator of PIC Microcontroller

Oscillator Circuit Tuning

The microchip devices have many purposes, such as frequency, voltage, and temperature measurements. These devices must have an external crystal or capacitor to meet the requirements of the applications. During the selection of these components, we need to keep the following factors in mind:

  1. The gain amplifier
  2. The resonant frequency
  3. Operational temperatures
  4. Oscillator start-up time
  5. Stability
  6. Life
  7. The power consumption
  8. The circuit simplification
  9. The use of standard components
  10. The combination of fewest components for desired result
  11. The range of supply voltages
  12. The desired frequency

We need to always keep the above factors in mind when tuning the oscillator or resonator.

Find the Best Values for Crystal

Here we will explain how to find the best values of crystal clock mode, C1, C2, and Rs. Mostly, for choosing the crystals, we use their parallel resonant frequency, but the design parameters are also important, like frequency or temperature tolerance. If you want to know more about the crystal operation and ordering information, then AN 588 is the best reference for you. The internal oscillator circuit in PIC micros is basically a parallel oscillator or resonator circuit, whose capacitance values are specific in the range between 20 PF and 32 PF.

At this range, the oscillator oscillates near the closest values of desirable frequency, but these values may juggle sometimes. The FOSC parameters are useful for choosing the clock mode. Clock modes are actually helpful for gain selection; lower gain is for lower frequencies, and higher gain is for higher frequencies. It is also possible to select a higher or lower gain depending on the need for the oscillator circuit. The selection of values for C1 and C2 is based on the load capacitance. But initially, the suggested values are used as suggested by the manufacturer and the table that is provided in the data sheet. Ideally, we choose the capacitor values in such a way that they must oscillate at the highest temperature and lowest VDD.

Applications of Oscillator

  1. It is actually an electronics circuit that produces the periodic oscillating signal that could be, at some point, a sine wave or a square wave.
  2. Its uses include signal generators for producing the oscillating signal. These signal generators then drive broadcasting devices such as radio, television, and transmitters.
  3. It is also useful in RF circuits for producing the RF oscillating signal.
  4. It is used in audio frequency devices for producing an audio frequency oscillating signal.
  5. The electronics amplifier is basically a linear oscillator, such as a transistor or op amp, that we can use as a feedback oscillator.
  6. The RC oscillator circuit, which consists of resistance and a capacitor, is helpful for producing lower frequencies.
  7. The LC oscillator circuit, which consists of an inductor and capacitor, is used for resonantly oscillating frequency signals.


In conclusion, this tutorial provides an in-depth overview of oscillators in microcontrollers. It also covers their types, workings, selection, tuning, and applications to help us better understand the concept. You can utilize these concepts for your complex microcontroller projects. Hopefully, this was helpful in expanding your knowledge.

You may also like to read:

This concludes today’s article. If you face any issues or difficulties, let us know in the comment section below.

2 thoughts on “Types of Oscillator Used in Microcontrollers”

Leave a Comment