oscillator

Status
Not open for further replies.

Angy

New Member
I have 4mhz crystal oscillator connected to a micro(16f946) with 27pf on both its legs.
How do I know that its working the right way?
I put a probe on it and I looked at the signal, it looks something like a sinewave but not exactly like one.
Can someone please explain.
 
Alot of people might tell you:

Hey it has a 8mhz internal OSC why use a Crystal.

But i wont...
The best way to test it in my opinion is to do some type of timed test like since you can probe it .. try flashing a LED at max speed. Since the pic cuts the OSC in 4 it will be 1 Mhz only so you can use the probe to verify its flashing at that speed.
 
Thanks for your response.
I understood from your response that a 4mhz crystal gives a 1Mhz internal clock frequency.( do all the pic's cut it by 4?)
Actual Frequency=so internal clk frequency /256=3906.25Hertz
1/3906.25=256uS is the time period?

Can you please explain, I would like to know what a 4Mhz with 27pf signal on the scope should look like?(sine wave?)

Is the amplitude of waveform controlled by Vdd ?
For this particular chip it says 20Mhz oscillator clock input on the datasheet. what does this mean?
 
As long as you are getting a rising edge thing should be fine. If your signal looks a bit like a sine wave, that is just because it is taking time to rise....

Yes, all PICs divide the oscillator input by 4. See any data sheet....
for why.

There is a difference between a crystal - like what you have with two pins, which needs a small capacitor on each leg to ground... and uses the PIC's internal hardware to create an oscillator. You can also clock a PIC with an oscillator, which is a self contained oscillator in a can. These usually have four legs, and put out a fairly strong signal, as opposed to the signal you will read from a leg of the crystal.

If I have some time today, I'll scope one and post the picture.
 
Im no guru but i can tell you what i know to get started. I know nothing on scopes

all PICs cut the clock by 4.. I think it applies to External and Internal.

So if you use a 20 Mhz crystal on it. It will essentially be a 5Mhz pic.

To connect any crystal to a pic i recommend follow the datasheet. in your case it starts on page 73.

Most important is page 78. I dont like that datasheet tho it doesnt show good enough information.

Here is a image of a part from the PIC16F54 Data sheet. It tells you recommended capacitance for the OSC. Hope it helps you.

 

Attachments

  • osc.png
    49.8 KB · Views: 292
Last edited:
Jason,
The helpful illustration of how the clock divider works with instruction pipe lining would be a good one to include here too. Do you know which illustration I'm referring to?
 
Yeah i think 1 minute:
This shows you how everything works.
Here ya go:
 

Attachments

  • osc2.png
    120.8 KB · Views: 257
Last edited:
heh im glad i could help

Ill see you guys in a bit ... lunch time
 
Last edited:
Anyway - back to the original question

The clock oscillator on a PIC (or other processor) looks like a fairly rough sinewave on a scope - it's also important to use a x10 probe, as the scope will often stop the oscillator otherwise.

Basically, if there's anything shown on the scope, it's working OK.
 
Thank you all for your suggestions, I appreciate your help.

I'm just going to assume that the oscillator is working right.
Now the actual problem I'm facing is with the AD converter.
When I simulate the software I get the error below, I already looked the same thread on this website but they did not give the solution.
ADC-W0008: No stimulus file attached to ADRESL for A/D.
so as the warning say no stimulus is attached to address register where the a/d value is stored.so can someone explain what I'm doing wrong?

Thanks.
 
heh your not doing anything wrong...

you just arent doing it fully...

i dont know how to attach that file but when you simulate something it has to know what values to send to it. Thats where that file comes in. I know someone will help
 
Can someone please explain How I should go about attaching stimuls file?
Thanks
 
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…