The External RC Oscillator mode allows the PIC® 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Ω.
The External RC Oscillator is selected with the Fosc bits in a configuration register.
The CLKOUTEN bit is also in a configuration register and typically in the same register as the Fosc bits.
Note: On older devices the OSC2 clock out option is incorporated into the Fosc settings instead of a separate CLKOUTEN bit to set.
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)
So a 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 data sheet 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)
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 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