PDA

View Full Version : Selecting a crystal frequency



lilimike
- 5th May 2010, 04:35
Hi,

I see that the different crystal frequencies are almost all the same price.
I have read many threads or specs that suggested the use of a higher crystal frequency to make everything more stable or more accurate.

Is there any advantage in selecting a 4 MHz over a 20 MHz?
Shouldn't I just select the highest crystal frequency supported by the PIC I am using?

Thanks to anyone for clearing this out.

Mike

mackrackit
- 5th May 2010, 05:09
I have read many threads or specs that suggested the use of a higher crystal frequency to make everything more stable or more accurate.
I am not so sure about that... Not sure that it make a difference in that respect.

Advantage of a low frequency would be the chip can be ran at a lower voltage. Interfacing with low voltage peripherals and battery supplied gadgets this is handy.

If you are using software serial and the baud is 9600 or higher you need a faster OSC.

Different PWM resolutions are scaled with different OSC speeds.

Timers / interrupts. The OSC speed will/maybe make a difference on how you code.

So it pretty much depends on the overall project. Just like deciding on any other part.

Do you have something specific in mind or just a general question?

lilimike
- 5th May 2010, 05:19
It was mainly a general question.

So what makes the difference is power consumption?

If power is not an issue then I could use the fastest crystal supported by the PIC and it wouldn't cause an issue?

mackrackit
- 5th May 2010, 05:36
If power is not an issue then I could use the fastest crystal supported by the PIC and it wouldn't cause an issue?
In general yes.
A chip running a 4Mhz will have a different resolution for the commands than say a 20MHz:
COUNT
PULSIN
PULSOUT
PWM
and maybe others I am not thinking about. So if you need a wider resolution then a slower OSC will be needed.

But in general, crank it up!!! :D It does not hurt the chip.

lilimike
- 5th May 2010, 05:43
Got it!

Thank you Dave

Mike