External RC Oscillator

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.

extrc.png

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.

foscbits.png
extrcbits.png

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.

oldfosc.png

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)
\begin{equation} Time = (Rext*Cext) ln [Vdd/(Vdd-Vih)] \end{equation}
(2)
\begin{equation} Fosc = 1/Time \end{equation}
(3)
\begin{equation} Instruction Clock = Fosc/4 \end{equation}

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.

rcspec.png

Example

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)
\begin{equation} Time = (10k * 22pf) ln [(5v/(5v - 4.5)] = 506 nanoseconds \end{equation}
(5)
\begin{equation} Oscillator Frequency (Fosc) = 1 / Time = 1 / 506 nanoseconds = 1.976 Mhz \end{equation}
(6)
\begin{equation} Instruction Clock = Fosc/4 = 494 Khz \end{equation}

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.

scope.jpg

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


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

© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
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.