8-bit PIC® MCU Oscillator Options

Last modified by Microchip on 2023/11/22 16:33

At the heart of the PIC® MCU is the oscillator module. The oscillator is the heartbeat or system clock source that makes the device run. The oscillator module has a wide variety of clock sources and selection features that allow it to be used in many applications while maximizing performance and minimizing power consumption.

Clock sources can be supplied from external oscillators, quartz crystal resonators, ceramic resonators, and Resistor-Capacitor (RC) circuits. In addition, the system clock source can be supplied from one of two internal oscillators.

The oscillator module can be configured in one of the following clock modes:

Clock source modes are selected by the FOSC<2:0> bits in a Configuration Word. The FOSC bits determine the type of oscillator that will be used when the device is first powered.

The ECH, ECM, and ECL clock modes rely on an external logic level signal as the device clock source.

The LP, XT, and HS clock modes require an external crystal or resonator to be connected to the device. Each mode is optimized for a different frequency range.

The EXTRC clock mode requires an external resistor and capacitor to set the oscillator frequency.

The INTOSC internal oscillator block produces low, medium, and high-frequency clock sources, designated LFINTOSC, MFINTOSC and HFINTOSC. A wide selection of device clock frequencies may be derived from these three clock sources.

A block diagram showing a typical oscillator module structure is below (captured from PIC16F1713):

typical oscillator module structure (captured from PIC16F1713) block diagram

Additional Enhancements to the Oscillator

The oscillator module has additional features that enhance the operation. These include:

  • 4x PLL: uses a Phase Locked Loop (PLL) to boost the oscillator speed by 4x. PLL is enabled by the PLLEN bit in a configuration word.
  • Clock Switchallows the software to change the clock source between internal and external sources.
  • Two-Speed Start-upeliminates the external oscillator start-up time and also reduces the overall power consumption of the device. This is very handy in applications that use the sleep function. The application can perform a few instructions using the internal oscillator and then return to sleep without having to wait for the external oscillator to become stable.

Instruction Clock vs Oscillator

The 8-bit PIC MCU system clock is always designated as Fosc in datasheets. The instruction clock is derived from the Fosc through a divider to deliver an instruction clock of Fosc/4 (1/4 the oscillator speed). This is done to allow the fetch and execute pipeline in the architecture to execute one assembly instruction per instruction clock cycle (except for branches and goto's which execute in two).

If a higher speed than a divide-by-four instruction clock is needed, then many devices have a 4x PLL option to boost the Fosc up by four which is later divided back down by four for the instruction clock. This will yield an instruction clock equal to the Fosc speed.