8-bit PIC® MCU External RC Oscillator

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

8-bit External RC Oscillator

The External RC Oscillator mode allows the PIC® microcontroller (MCU) to be clocked by a simple Resistor-Capacitor (RC) combination. This offers a low-cost option for the oscillator in applications that don't require precise timing and is especially useful for older devices that don't have an internal oscillator option.

The RC connects to the OSC1 pin. The OSC2 is not needed and can be used as a clock-out pin or a general-purpose I/O. The OSC2 pin option is selected by the CLKOUTEN bit in a configuration word.

The External RC setup is shown in the figure below.

The RC oscillator frequency is a function of the supply voltage (Vdd) for the device, the resistor (Rext) value and the capacitor (Cext) value. Operating temperature also plays a key role in the accuracy of the RC-created frequency.

Typical value ranges include:
For Vdd < 3 volts:
10k ≤ Rext ≤ 100k

For Vdd ≥ 3 volts: 
3k ≤ Rext ≤ 100k

For Vdd: 2 - 5 volts:
Cext > 20pf

For REXT values below 2.2 kΩ, oscillator operation may become unstable, or stop completely. For very high REXT values (e.g. 1 MΩ), the oscillator becomes sensitive to noise, humidity and leakage. Thus, it's recommended to keep REXT between 3 kΩ and 100 kΩ.

Configuration Settings

The external RC oscillator is selected with the FOSC bits in a configuration register.

FOSC bits external clock oscillator mode

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

CLKOUTEN  ​external clock oscillator mode

external clock oscillator mode bit 11 ​CLKOUTEN   ​

Tip: On older devices, the OSC2 clock-out option is incorporated into the FOSC settings instead of a separate CLKOUTEN bit to set.

Calculating Frequency

The OSC1 pin is a Schmitt trigger input. The charge time to reach the Vih level will control the period of the signal and thus the frequency.

(1) Time=(Rext∗Cext)ln[Vdd/(Vdd−Vih)]

(2) Fosc=1/Time

(3) InstructionClock=Fosc/4

So the RC value is selected to result in the instruction clock rate that is desired for the application.

The data sheet electrical specifications for the device will specify the Vih threshold but in most devices Vih = 0.9*Vdd as seen in the sample datasheet section below.


Here is an example using the values below for the RC oscillator.

Vdd = 5v
Vih = Vdd * 0.9 = 4.5v
Rext = 10k
Cext = 22pf

The calculations show the charge time of the RC circuit to reach the Vih level is 506 nanoseconds.

(4) Time=(10k∗22pf)ln[(5v/(5v−4.5)]=506nanoseconds

(5) OscillatorFrequency(Fosc)=1/Time=1/506nanoseconds=1.976Mhz

(6) InstructionClock=Fosc/4=494Khz

Using these values in an actual circuit with a PIC16F690, the scope plot shows the RC charge and discharge waveform in blue. The configuration is set to send the instruction clock (CLKOUTEN = 1) out of the OSC2 pin. The clock-out signal is captured in the yellow waveform.

The actual Vdd = 4.67v.
Rext = 10k +- 10%
Cext = 22pf +- 20%

The results show parameters in the range of the calculated values but certainly off due to the variations in the components.

The measured frequency is a 420 Khz instruction clock based on an RC charge time of around 595 nanoseconds.


  • Yellow - Instruction Clock (CLKOUT on OSC2 pin)
  • Blue - RC charge/discharge signal

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