3
\$\begingroup\$

I know this may be a pretty silly question but since I'm a beginner I am not so familiar with PIC working procedure. PIC F54 RC Oscillator

The chip needs an oscillator to make it go. Here it's shown an RC arrangement that is connected to OSC1 channel. The capacitor after a second charges up and the voltage across the capacitor will be at +5V. But it doesn't make sense to me. The RC circuit does not produce an oscillatory wave from a pulse. We need to feed up the channel OSC1 with a sinusoidal wave which has a well-defined frequency. We know that the LC circuit takes as input a pulse and gives out a sinusoid. So why don't we use an LC circuit instead? What is wrong with me?

Best

\$\endgroup\$
1
  • \$\begingroup\$ I was just trying to get my head around this exact same question and this thread has explained it very well. It's actually quite simple as well. Thanks :) \$\endgroup\$ Aug 4, 2021 at 10:35

2 Answers 2

8
\$\begingroup\$

The RC oscillator is used because it is cheap. Here is the internal circuit from the PIC16F54 datasheet:

enter image description here

The RC charges until the voltage exceeds the upper threshold of the buffer, at which point the transistor switches on and discharges the capacitor to the lower threshold of the Schmitt trigger buffer, and the process repeats after the transistor turns off. The net result is a sawtooth-like waveform across the capacitor. The transistor is much lower 'resistance' than the external resistor so the discharge is very abrupt relative to the charge.

If you really want to use an LC circuit, you can use the crystal/resonator oscillator options, but most engineers would pick a ceramic resonator or a crystal where a bit better stability than the RC can offer is required.

Newer PIC chips have a calibrated internal RC oscillator that is attractive in many useful applications- some are now good enough to allow reliable serial communications over an acceptably wide temperature range. The next step up in common requirements is timekeeping and that requires a crystal unless you're willing to sync with some external clock very frequently.

\$\endgroup\$
5
\$\begingroup\$

Ah, but there's some magic behind the OSC1 pin! It turns the external RC into an oscillator. As the voltage rises, once it reaches around 2/3rds rail, a transistor dumps the capacitor voltage back down to ground. Then the cycle repeats.

Check out section 2.4 of this link. It's usually a good idea to search the manufacturer's data first, they tend to tell you stuff.

For the record, googling 'PIC RC oscillator' generated that hit.

\$\endgroup\$
6
  • 1
    \$\begingroup\$ This answer would improve a lot if you explain that the magic is as simple as a comparator and a switch instead of simply referring to it as magic. The link can go away tomorrow and then your answer is worthless, and googling "PIC RC oscillator" may or may not give the same result in the future. \$\endgroup\$
    – pipe
    Mar 8, 2016 at 10:29
  • \$\begingroup\$ @pipe yeah, I've sort of got there myself, link only answers not good. \$\endgroup\$
    – Neil_UK
    Mar 8, 2016 at 10:36
  • \$\begingroup\$ @Neil_UK I got what you said. But the question is how the process repeats after it's first grounded? What should again make it charge up? \$\endgroup\$
    – dirac16
    Mar 8, 2016 at 10:43
  • \$\begingroup\$ The transistor gate should be connected to a diode or something? That could do the job. right? \$\endgroup\$
    – dirac16
    Mar 8, 2016 at 10:47
  • \$\begingroup\$ R1 makes it charge up again. The trick is that the internal transistor turns on for a while, then off by itself. \$\endgroup\$
    – Neil_UK
    Mar 8, 2016 at 11:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.