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.

cystals/oscillators

Status
Not open for further replies.

kitedude

New Member
hi
i've a few quick questions

whats the difference between a crystal and an oscillator?? are they the same thing???

i've simulated my code on the MPLAB IDE board, but when i program the pic and put it in my circuit it goe smuch much faster than expected.

i'm using a 20mhz crystal, 2 20pf caps and an resisto rin series between osc2 nad the crystal leg.

any ideas what would cause the difference
 
i don't know what oscillator speed setting you simulator is in. Assuming it is 4 mhz, the real thing your running is 5 times faster since you are using a 20mhz.

You can swap the 20mhz crystal for a 4mhz one.

EDIT: I dont know why you added the resistor in parallel with the crystal.
 
pike said:
EDIT: I dont know why you added the resistor in parallel with the crystal.

It's not in parallel, it's in series (as he clearly stated).

It's an optional resistor for use in HS mode with certain types of crystals, it limits the current to prevent the crystal been overdriven.

Personally I've never used one, and never had a problem, but the MicroChip datasheets explain what it's for, and that it might be required under certain circumstances.
 
I've it already set for 20mhz,

***********************
#use delay(clock=20000000)
************************

Nigel's correct i go tthe idea to use thr esistor from the datasheet.

it seems that it is over driven. if i want to bring up on a scope where should i take my reading from.

osc1 ---ground??
osc2 -- probe??

whenn i do this it kills the signal

if i just probe osc2 i get a signal that is far from a sine wave, i'll see i f i cna use wavstar to get a screen shot.
 
kitedude said:
osc1 ---ground??
osc2 -- probe??

whenn i do this it kills the signal

NO!!!!!!!!!!!!!! - that's wrong!!.

You connect ground of the scope to ground of the circuit, the probe goes to either OSC1 or OSC2 and should be set to x10 - a x1 will probably stop the oscillator.
 
:idea:

If you don't get any joy with the scope probe on the osc pins, write some code to toggle a spare i/o leg, you can then get the frequency from this (don't forget to divide by 4 for the internal divider and then divide some more to into account your toggling code) :wink:

Another idea is to bring up the "StopWatch" under "Debugger/StopWatch" (in mplab 6.x) this will show you what your project "thinks" it has connected to it.....

Hope this helps!
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top