I'm trying to use an RC oscillator on a PIC 16F84A-20 that I have on a breadboard. The code is supposed to (at this point) simply flip an output back and forth every so often.

I don't need it to run very fast, so I figured I'd try using the RC network on CLKIN instead of a crystal. My problem is that my code doesn't seem to be running consistently (I get some LED flashes for a few seconds, then nothing, then perhaps more flashes, etc).

I'm working on a plug-in breadboard. I've got +5 provided by a PIC dev board I had handy. +5 is reading 4.94 volts via my DMM. I used a 4.7K resistor from CLKIN to +5, and a 33pf cap to GND.

I put an o-scope on CLKIN, and I see a sawtooth-ish wave of about 2.5Mhz, but I also see some other, longer waveform in the background, if you will (it's far fainter than the sawtooth). it's a much wider, slowly decaying pulse. The sawtooth wave is, unfortunately, only about .2-.3 volt high, and centered between +5 and GND.

I put the scope on CLKOUT, and in the instances where I'm seeing my LEDs blink, I've got a nice squarewave on CLKOUT. Other times it's just flat.

My assumption is that I've made some basic error with the RC circuit that's causing it to not generate a sufficient waveform, and thus not work. I'd like pointers to what I should be checking next.


Is MCLR pulled up? Leaving it floating can cause intermittent operation like that.

| improve this answer | |
  • \$\begingroup\$ That was it. I was concentrating so hard on the RC thing that I completely failed to examine the rest of the pins I wasn't using! Thanks! \$\endgroup\$ – Michael Kohne Oct 18 '10 at 16:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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