[General] How to work out the R and C values for PIC RC oscillator?

Status
Not open for further replies.

JohnJohn20

Advanced Member level 4
Joined
Feb 2, 2012
Messages
111
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,296
Visit site
Activity points
2,377
I am looking at using a PIC16F54 chip to make a make an LED dice. it is cheap and my programmer can cope with it.

An RC oscillator option is available in the datasheet, and a picture of how to connect the R and the C, but no actual formula is given, just that Fosc is dependent on temp, Vdd etc.

So any ideas of even an approximate formula?

Thanks.
 

The RC option is there for extremely low cost solutions, Microchip used to show a graph of the RC/F combinations but I think they dropped it to stop people relying on it. With R values typically 5% tolerance, C typically 10% and the effects of external capacitance being so prevalent, it made little sense to give a formula or specification that 'might' work in some circumstances.

Their data sheet suggests you use the f/4 output to monitor the frequency and adjust the values (typically R) until you get the frequency you want. Even connecting a frequency counter to the oscillator pin itself could throw it way off frequency!

I would suggest the R values should be in the range 5K to 1M and the C values between 10pF and 1uF for reliable results. Higher R and lower C will give a higher frequency but also increase suscepibility to outside influences.

Brian.
 
Thanks Brian. As a teacher with about 100 students making these devices we are looking for a very cheap option. As speed is not that important, would you hazard a guess what kind of frequency 5K R and .1uF C might give me.

Chris
 

Sorry for the late reply.

With those values I would *guess* you are going to get a frequency of around 10KHz which is fast enough for simple projects but slow for any complex or 'real-time' processing. For a more responsive program you should consider dropping the capacitor to around 100pF which should increase the clock to around 500KHz.

It's worth noting that even when Microchip did include the frrequency graphs they gave it as much as +/- 31% tolerance!

Brian.
 
Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…