1
\$\begingroup\$

Edit: Sorry, had messed up the capacitor values as I didn't take into account the values halve per leg. This should be fixed now...

I'm needing to attach a crystal to a microcontroller (a PIC16F84A), but the crystals I'm looking at are the 32.768Khz crystals which have either a 6pF, 12pF or as 12.5pF load capacitance. The thing is, I cannot get any capacitors with those values, the closest I can get is a 10pF (5pF per leg), a 15pF (7.5pF per leg) and a 22pF (11pF per leg). Also, the datasheet for the microcontroller says that when running at 32kHz it recommends I use 68-100pF for each capacitor. So:

1) Is the datasheet for the microcontroller really specifying a 32Khz crystal, or is it standard to refer to 32.768 crystal as a 32kHz crystal?

2) Would the capacitors I can actually buy (10, 15 and 22 pF) be suitable, when considering the crystal is specifying slightly different values?

3) Why are the capacitor values specified on the microcontroller datasheet so wildly different from those specified by the crystal? Surely only one of them can be correct, and what effect would this have if one of them is ignored?

Thank you!

\$\endgroup\$
7
  • 1
    \$\begingroup\$ possible duplicate of Crystals and Load Capacitance \$\endgroup\$
    – endolith
    Commented Nov 28, 2011 at 14:55
  • 1
    \$\begingroup\$ Why are you using a 32kHz crystal with a 16F84A? It'll run very slowly. There are newer PICs with an RTC, which will run at 20 MHz or more on the primary oscillator. \$\endgroup\$ Commented Nov 28, 2011 at 14:56
  • 1
    \$\begingroup\$ The load capacitance is going to have contributions from the PCB layout anyway. The correct value is determined by the crystal, not the microcontroller. The value only has to be exact if you care about the frequency being exact. \$\endgroup\$
    – endolith
    Commented Nov 28, 2011 at 14:57
  • 1
    \$\begingroup\$ @LeonHeller Hello, thanks, although to be honest the pic does very little work. It checks for an interrupt, waits a little while before outputting a high or a low on a particular pin. Nothing fancy at all, so I figured run it slower and save power. \$\endgroup\$
    – R4D4
    Commented Nov 28, 2011 at 15:01
  • \$\begingroup\$ @endolith I did quite a bit of searching and noticed that post, but it doesn't mention the effects of using different capacitor ratings for both the chip and the crystal. I'm not too concerned to be honest about the exact frequency, as it's hardly a real-time application. \$\endgroup\$
    – R4D4
    Commented Nov 28, 2011 at 15:03

3 Answers 3

2
\$\begingroup\$
  1. Yes, a 32.768 kHz crystal is often referred to as a 32 kHz crystal. I think it's rather sloppy personally, as it only costs another 4 characters to make certain of avoiding any potential confusion.

  2. Yes, they will all work. Unless you need the frequency to be absolutely spot on then e.g. 22pF will do.

  3. If you look at the notes in the datasheet it says they are for design guidance only, for exact values consult the crystal manufacturer. So the crystal datasheet is the one to go from. As Endolith says the microcontroller doesn't affect the correct load capacitance value (well maybe a tiny bit with the pin capacitance)

I agree with Olin that the 16F84A is an antique - if you grab one of the newer PICs you will give yourself far more options. The PIC16F1828 is a nice part, internal RC/PLL up to 32MHz and loads of nice peripherals. Probably won't be much more than the 16F84A, may even be cheaper.

\$\endgroup\$
1
  • \$\begingroup\$ Also keep your eyes open for low-power crystal oscillators in the newer controllers. (I know the newer Atmels have these, at least.) They have less power consumption and EMI since they oscillate by only about 1 V and usually use sine waves instead of square waves. \$\endgroup\$ Commented Nov 28, 2011 at 21:38
1
\$\begingroup\$

If all you want to do is run a PIC at low speed to save power and timing accuracy isn't important, then there is no need for a crystal. The 16F84A is a old part. Newer parts have built in R-C oscillators. Some parts even have a special low power low speed R-C oscillator built in.

Explain what the PIC really needs to do and we can probably suggest a better part than the 16F84A (as most are).

\$\endgroup\$
1
  • \$\begingroup\$ Hi Olin, thanks for the answer - it literally needs to sleep until an interrupt, waits a little while before setting a certain pin high or low. The reason I specified the 84A is because I've got one already, so for such a simple job it seemed to make sense to use it. Thanks. \$\endgroup\$
    – R4D4
    Commented Nov 28, 2011 at 17:16
1
\$\begingroup\$

Since Microchip does produce a lot of development boards, you might want to look at the schematics of a few that use your chip's family. The Explorer 16 board uses two 22pF capacitors into the Plug-in Module (PIM) socket (the removable chip), and a 1MOhm resistor and two 22pF capacitors for the onboard PIC18 (this is for 20MHz instead of 32.768kHz). The PIC18 Explorer board also uses the two 22pF capacitors.

Also, here is a document on oscillator design from Digi on oscillator circuits for Rabbit processors:

ftp://ftp1.digi.com/support/documentation/0220084_e.pdf

Page 9 gives an equation on how to calculate the load capacitance. From your crystal's datasheet and the board, you have to estimate the C_s and C_in values. The document does list some generic values (2-5pF 6-6.5pF). If an exact frequency is required, you may need to tune the capacitor values.

\$\endgroup\$

Your Answer

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

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