Internal Oscillator

The Internal Oscillator Mode uses two independent oscillators and a dedicated High Frequency Phase Locked Loop (HFPLL) to create three internal oscillator clocks.

The three blocks include:

  • HFINTOSC - High Frequency Internal Oscillator (factory calibrated to run at 16 MHz). This oscillator is derived from the 500 kHz source and the HFPLL.
  • MFINTOSC - Medium Frequency Internal Oscillator (factory calibrated to run at 500 kHz).
  • LFINTOSC - Low Frequency Internal Oscillator (uncalibrated 31 kHz clock source). This is the same oscillator used for the Watchdog Timer, Power-up Timer and Fail-Safe Clock Monitor.

The HFINTOSC and MFINTOSC are routed through a multiplexer to produce a range of frequencies than can be selected with three bits in the OSCCON register.

The range includes:

  • 16 MHz (HFINTOSC)
  • 8 MHz
  • 4 MHz
  • 2 MHz
  • 1 MHz
  • 500 kHz (MFINTOSC)
  • 250 kHz
  • 125 kHz
  • 62.5 kHz
  • 31.25 kHz
  • 31 kHz (LFINTOSC)

These are selected through the IRCF bits of the OSCCON register.

intosc.png

The Internal Oscillator is enabled by one of two methods:

  • Set the Fosc bits in a configuration register to select the internal oscillator
  • Set the SCS bits in the OSCCON register to select the internal oscillator

The OSC1 and OSC2 pins are available as general purpose I/O when the internal oscillator is selected. The OSC2 pin can also be used to output the instruction clock with a configuration setting.

Internal Oscillator Setup

To select the internal oscillator with the Fosc bits in a configuration register, the INTOSC is selected via the Fosc bits.
Note: The SCS bits of the OSCCON register must also be set to "Clock Determined by FOSC" selection.

foscbits.png
intoscbits.png

To select the internal oscillator with just the SCS bits in the OSCCON register, the "Internal Oscillator Block" associated bits are selected.

scsosccon.png
scs.png

OSC2 Pin Clock Out Option

The CLKOUTEN bit is also in a configuration register and typically in the same register as the Fosc bits.

clkout.png
clkoutbits.png

Note: On older devices the OSC2 clock out option is incorporated into the Fosc settings instead of a separate CLKOUTEN bit to set.

oldintosc.png

Selecting the Oscillator Speed

Once the internal oscillator is enabled the internal oscillator frequency select (IRCF) bits in the Oscillator Control Register (OSCCON) are set to select the oscillator frequency. The four bits select one of 15 different oscillator selections.

ircfosccon.png
ircf.png

Internal Oscillator Start-up

The Internal Oscillator start-up is very quick and the internal oscillator will run the device at start-up if it is selected as the main oscillator, Two Speed Start-up is enabled or Fail-Safe Clock Monitor is enabled. The status of the internal oscillator can be monitored through the Oscillator Start-up Timer Status bit (OSTS) in the OSCSTAT register. It will be cleared when the internal oscillator is running.

oscstat.png
ostsbit.png

32 MHz Oscillator

A 32 MHz source can be created by routing the 8 MHz output through an external 4x PLL which is available on many devices. The following settings must be established to run on an internal 32 MHz system clock:

  • The Fosc bits in a Configuration register must be set to INTOSC selection
  • The SCS bits in the OSCCON register must be cleared to use the "Clock determined by Fosc" setting
  • The IRFC bits in the OSCCON register must select the 8 MHz HFINTOSC
  • The SPLLEN bit in the OSCCON register must be set to enable the 4x PLL

A 32 MHz oscillator will result in an 8 MHz instruction clock (Fosc/4) after the divide by four operation in the oscillator block.

Internal Oscillator Frequency Adjustment

The OSCTUNE register can alter the frequency of the HFINTOSC and MFINTOSC through minor adjustments. The OSCTUNE contains a 6-bit value that can adjust the frequency within a range of +/-12 % of the selected frequency. The upper range of tuning in the OSCTUNE register are values; 01h - 1Fh. The lower range of tuning in the OSCTUNE register are the values; 20h - 3Fh. With the OSCTUNE set to 00h, the internal oscillator frequency will not be affected.

osctune.png
osctunebits.png

For more detail on adjusting the internal oscillator with the OSCTUNE register refer to application note AN244.


For more information on 8-bit oscillator options visit the 8-Bit Oscillator Options article.

© 2016 Microchip Technology, Inc.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.