8-bit PIC® MCU Oscillator Options

Last modified by Microchip on 2024/11/25 14:30

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 bits in a Configuration Word.

  • For older devices the FOSC bits determine the type of oscillator that will be used when the device is first powered.
  • In newer devices the RSTOSC bits determine both the type of oscillator and also some start-up frequency options.
  • The newest devices allow the external clock input pins to be configured using the FEXTOSC bits so that peripheral devices (like timers) can use the external clock while using a different oscillator as the FOSC clock source.

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.

The accompanying image shows a block diagram of a typical oscillator module structure (captured from PIC16F1713):

typical oscillator module structure (captured from PIC16F1713) block diagram

Back to Top

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. For older devices the feature is enabled using the IESO configuration bit. For newer devices, the RSTOSC value should be configured for the start-up oscillator and then software must enable the external crystal immediately after execution begins, and there are additional features to control when the switch-over happens.

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 gotos 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.

Back to Top