PDA

View Full Version : 20 Mhz Crystal, simple blinking LED



BenjaminsShinob
- 14th October 2007, 09:25
Hey, I have been trying in vain to use a 20Mhz Crystal to do a small program with the FREQOUT command. This is the program I've been using to test the crystals

Main:
High portc.4
Pause 500
Low portc.4
Pause 500
Goto Main

I've tried it with DEFINE OSC 20, ie like this:

DEFINE OSC 20

Main:
High portc.4
Pause 500
Low portc.4
Pause 500
Goto Main

And still to no avail. I have used 3 different PIC18f452's, 2 PIC18f442's and 1 PIC18f252...I have also tried three oscillating crystals, one powered crystal by abracon, and two passive ones by IQ. I've tried the passive ones with 22pf and 10pf capacitors and no capacitors, all to no avail. The same circuits work fine with a 4mhz crystal, I've tried one passive and one powered crystal in the 4mhz range. I've read that due to the breadboards impedance that this could be causing the passive crystals to work incorrectly, but I've even tried touching the crystals directly to the pins and nothing. I just got these crystals and a few of the pics have never been programmed before and once again, the circuits work fine with a slower 4mhz crystal. If someone could help I'm completely mystified as to what's going on.

Let me know if I'm leaving anything dumb out or whatever. Thanks

Steve_88
- 14th October 2007, 09:30
Make sure you are programming your pic for HS (high speed) Sounds like it is set to XT.

BenjaminsShinob
- 14th October 2007, 09:44
How do you do this in PicBasic Pro, I can't seem to find it in the manual

exelanoz
- 14th October 2007, 10:58
Whether you use XT (4Mhz or below) or HS (Above 4Mhz) the Fuse settings can be programmmed as part of your hex file...or alternatively you should be able to set this with your programming software at the time chip is being programmed...look for HS or XT options.
The thread below will give you a good guide how to set it as part of your hex file.

http://www.picbasic.co.uk/forum/showthread.php?t=543

I tend to leave it on HS option on no matter what crystal I am using, works perfectly fine with any speed...

Cheers

Archangel
- 15th October 2007, 00:20
I tend to leave it on HS option on no matter what crystal I am using, works perfectly fine with any speed...

Cheers

What HS does is to make the osc. use more power, apparantly the faster it runs the more power it requires. As per one of them thar datar sheets. ;)

RodSTAR
- 16th October 2007, 05:06
you can set those PIC configurations switches in the program that writes your HEX code to the chips (usually IC-Prog or WinPIC800). Those are Oscillator settings. Set to HS (High Speed)