8-bit PIC® MCU External Crystal Oscillator Modes

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

The External Crystal Oscillator Mode is for external quartz ceramic resonators or crystals to be connected to the PIC® microcontroller (MCU) device as the clock source. The clock source will drive all the peripherals and the instruction clock. The circuitry inside the device is an inverter amplifier that is designed to drive the quartz oscillator with the proper drive current based on the mode selected. There are three levels of drive current for the quartz oscillator:

  • LP - This oscillator mode selects the lowest gain setting for the internal inverter amplifier. It is the lowest current consumption of the three modes. It's designed to drive a 32.768 kHz tuning fork-type crystal.
  • XT - This oscillator mode selects the intermediate gain for the internal inverter amplifier. This mode is typically selected for crystals or resonators in the range of 4 Mhz or lower.
  • HS - This oscillator mode selects the highest gain setting for the internal inverter amplifier. This is the highest current mode and is typically used with crystals or resonators above the 4 Mhz range.

The crystal or resonator is connected to the OSC1 and OSC2 pins. The crystal or resonator will also require capacitors on each pin in the range of 15 pf - 20 pf. These values can be tuned for the accuracy of the oscillation frequency. There may be times when the drive current needs to be limited to the quartz crystal. A series resistance can limit the current. A parallel resistance may also be needed to help with the proper start-up of the oscillator. For best performance, the crystal manufacturer can offer design recommendations for the application.

Oscillator Start-Up Timer

The Oscillator Start-up Timer (OST) is a delay built into the PIC MCU device to allow the oscillator to stabilize. The OST senses or counts 1024 oscillations from the crystal or resonator into the OSC1 pin. The count begins after the Power-on Reset (POR) and when the Power Up Timer (PWRT) has expired (if enabled).

During the 1024 counts, the program counter is not incremented so no code can be executed. This allows the oscillator to stabilize before executing instructions. The 1024 counts can cause latency between power up and code execution which can be critical for some applications. To work around this delay, the Two-Speed Start-up or the Fail-Safe Clock Monitor (FCSM) will allow code to be executed during the 1024 counts if either of them is enabled.

Configuration Settings

The External crystal or ceramic oscillator mode is selected with the Fosc bits in a configuration register.

External clock oscillator mode

Information

Tip: For more information on 8-bit oscillator options, visit the "8-bit PIC MCU Oscillator Options" page.