PDA

View Full Version : 20Mhz crystal cause led to blink irreguarly



niknaksbarbeque
- 13th April 2005, 16:41
Hi,

Has anyone had trouble getting a 20 mhz crytal with a breadboard and Pic18f452 working reliably.

All I want to do is just make a light blink on and off (reguarly). Everything works fine with a 4MHz crystal (the light blinks reguarly). But when I switch the Crystal to 20 Mhz, update the Configuration Oscilator setting to HS and put DEFINE OSC 20 at the top of my code the light blinks but, its really irregular. (I also made sure that the "update configuration from file setting is switched off"). I have the correct value of capicators for the crystal also.

I'm about to tear my hair out.
Here's my code

DEFINE OSC 20

MAIN:
high portd.1
pause 4000
low portd.1
pause 4000
GOTO main

It's not a powered oscillator (could this be the problem)?
Apologies if this is a really think question, just starting out and have very very basic electronics knowledge.

Thanks
Mark
p.s. Massive Karma is going out to anyone who answers 'cause I'm about to chuck the bloody thing out the window :)

NavMicroSystems
- 13th April 2005, 18:41
Mark,

it is most likely your breadboard causing the problem.

This has already been discussed here (http://www.picbasic.co.uk/forum/showthread.php?t=986)

niknaksbarbeque
- 13th April 2005, 19:03
Thanks very much for replying, it's a wee bit lonely doing all this stuff myself, really appreciate it.

Mark

niknaksbarbeque
- 16th April 2005, 11:35
I got a 20 mhz powered crystal oscilator today and it's sorted all the problems. Didn't try the other solution 'cause I took a few days off (really was having a **** time of it and needed a wee break) and waited for the crystal from "RS Components" to come. Been reading on the web that apparently it provides a much stronger timing signal and so far that seems correct (well I've got that f*cking light blinking anyway!)

Cheers
Mark