Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Crystal Confusion

Status
Not open for further replies.

micro571

New Member
I'm working with a PIC18F4455. It is rated up to 48 MHz.

I have both a 20 MHz crystal and a 48 MHz crystal.

With my 48 MHz crystal, I have an event that is supposed to take exactly 3 seconds, but takes ~9.7s. If I put in the 20 MHz crystal, it takes ~7.2 seconds, which is exactly how long I expect it to take @ 20 MHz.

The 48 MHz crystal I have is here:
**broken link removed**

I notice that the operating mode is 3rd Overtone. Does this mean that it is running at 1/3 of 48 MHz? The math would suggest that.

If that's the case, which type of crystal am I looking for to get a full 48 MHz?
 
I'm working with a PIC18F4455. It is rated up to 48 MHz.

I have both a 20 MHz crystal and a 48 MHz crystal.

With my 48 MHz crystal, I have an event that is supposed to take exactly 3 seconds, but takes ~9.7s. If I put in the 20 MHz crystal, it takes ~7.2 seconds, which is exactly how long I expect it to take @ 20 MHz.

The 48 MHz crystal I have is here:
**broken link removed**

I notice that the operating mode is 3rd Overtone. Does this mean that it is running at 1/3 of 48 MHz? The math would suggest that.

If that's the case, which type of crystal am I looking for to get a full 48 MHz?

You're unlikely to find a 48MHz crystal, they don't really go that high - as you found, your 48MHz one is only 16MHz.

The 18F series have an internal PLL, so you can use a lower frequency crystal, and multiply it up - consult the datasheet.
 
Thanks for the fast reply!
I've read the datasheet and understand how the PLL works now.

For others reading this thread in the future, a lower speed oscillator is used and multiplier registers are specified that allow the PLL (phase-locked-loop) run the microcontroller at a faster speed.

Question: The microcontroller is rated for 48 MHz. Is it likely I'd run in to problems trying to run it at 64 MHz? For my specific application, I could use a little bit of extra performance.
 
Yes it'll probably crash at that speed. If you need faster then move to a 16bit PIC.

What do you have that requires 16MIPs?
 
Last edited:
For anyone interested, the system seems to be working fine at 64 MHz.

"What do you have that requires 16MIPs? "
We are controlling pneumatic valves. We need to control them extremely precisely, with 50 microsecond resolution. There are 24 and each valve has a programmable onTime value. Example, we may need to turn one valve on for 9.10 ms and another for 8.75 ms. To get accurate timing with that resolution and programmable onTimes, we need a pretty fast processor. I've been using the MPLab SIM to see how thing will work out. We can get the resolution with 64 MHz (16 MIPS), but not quite with 48 MHz. Maybe we could with some more code optimizations.


Edit: Answering the question.
 
Last edited:
So how do you get valves that open or close in uS timings?.
I like to see one I got
bucket full that came from where i worked. Air not as fast as light
 
I don't know how important accuracy of timing is compared to precision.

By running at 64 MHz, and 16 MIPS, one instruction cycle is 0.0625 µs. That is the precision that you have.

Accuracy is a measure of how close to 16,000,000 instructions you execute in 1 second. Running a 48 MHz 3rd overtone crystal at 16 MHz is not very accurate and you could be running up to 0.2 % away from 16 MHz. The crystal will have been adjusted at 48 MHz, and the temperature dependence will be less at 48 MHz than at 16 MHz

You should really use a 16 MHz fundamental crystal, such as:-
Digi-Key - 300-8437-ND (Citizen Finetech Miyota - CSA309 16.000MABJ-UB)

As you have found, it is easier to get an overtone crystal to oscillate at fundamental than it is at overtone. An overtone oscillator needs to have some components to give it more gain at the overtone frequency than at the fundamental.

The oscillator in a PIC18F4455 will not run a crystal at 48 MHz, as it is only designed to run to 24 MHz or so.

I am also not sure if the PIC18F4455 will work OK at 64 MHz at high temperatures.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top