3
\$\begingroup\$

I'm working with a PIC16F877A. Do I need to add another external oscillator to pins 13 & 14 or can I use its internal oscillator with 4MHz frequency?

I don't need precise timing in my project. I just want a delay of 10 seconds which I can generate with an internal 4MHz oscillator.

\$\endgroup\$
2
\$\begingroup\$

It doesn't appear to have an internal oscillator capable of generating its own clock, but if you check page 146 of the PIC16F87XA datasheet it shows how you can use an RC oscillator if cost rather than the number of I/O pins is an issue. The PIC Mid-range Family Guide oscillator section includes the following recommendations:

For REXT values below 2.2kΩ , 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, we recommend keeping REXT between 3 kΩ and 100 kΩ.

Although the oscillator will operate with no external capacitor (CEXT = 0 pF), we recommend using values above 20 pF for noise and stability reasons. With no or small external capacitance, the oscillation frequency can vary dramatically due to changes in external capacitances, such as PCB trace capacitance and package lead frame capacitance.

While the design is based on a relaxation oscillator I found several references to Microchip not committing to an exact time determination formula. However on page 200 of the datasheet you'll find a graph of typical frequencies for several resistor / capacitor combinations. If you're running at 5V it looks like 20pF and a 5.1 kΩ resistor should be close to the mark.

I guess you're using a chip you already have on hand, but the more modern devices include internal clock options that are much more accurate and leave the I/O pins available for other uses. If you won't really need that much speed you could also consider running it as a lower clock rate, as 4MHz is the highest recommended rate and component tolerances may push it over that limit.

\$\endgroup\$

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.