PIC18F4685 40Mhz Crystal configuration

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
Speedy2k
Posts: 91
Joined: Mon Aug 06, 2012 5:04 am
Has thanked: 2 times
Contact:

PIC18F4685 40Mhz Crystal configuration

Post by Speedy2k »

Hi, I have a PIC18F4685 that i try to run on a External 40Mhz Crystal, I connect the crystal between pin 13 and 14 of the PIC and add 2 22pF cap between pin 13 and 14 to ground. But with the 1 sec led flash, i can not find a way to make this chip start at all. hat are the configuration required in Flowcode to make this setup start ? Tanx a lot!

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: PIC18F4685 40Mhz Crystal configuration

Post by Benj »

Hi Speedy,

Try these config settings.
PPP_Config.jpg
(257.92 KiB) Downloaded 651 times
Also are you pulling the MCLR pin up to VDD using a resistor? If not then change the "Master Clear Enable" config setting.

Speedy2k
Posts: 91
Joined: Mon Aug 06, 2012 5:04 am
Has thanked: 2 times
Contact:

Re: PIC18F4685 40Mhz Crystal configuration

Post by Speedy2k »

I have tried those settings and still no go! To make the chip run at 8Mhz on internal oscillator, i was using the osccon = 0x76;, I have removed it to run at 40Mhz, but does i need to change it or set anything else in my code ?

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: PIC18F4685 40Mhz Crystal configuration

Post by Benj »

Hello,

Have you got the datasheet for the crystal you are using. I have had problems before where the shunt capacitance of the crystal was too large meaning it wouldn't work correctly with a PIC micro. You should not require any additional code at the start of your program to get the crystal working. The device does have an onboard PLL or phase locked loop which you can use to multiply the speed of a much slower crystal. Would this be worth a go?

Speedy2k
Posts: 91
Joined: Mon Aug 06, 2012 5:04 am
Has thanked: 2 times
Contact:

Re: PIC18F4685 40Mhz Crystal configuration

Post by Speedy2k »

I have nerver been able to make the 40Mhz work, but with the exact same cap, the 19660800Mhz work perfectly!!

Mikat
Posts: 258
Joined: Wed Nov 29, 2006 6:32 pm
Location: Finland
Has thanked: 7 times
Been thanked: 36 times
Contact:

Re: PIC18F4685 40Mhz Crystal configuration

Post by Mikat »

Hi.

Try without caps, I might work.
Or at least I have used 25MHz Xtals without caps for quick testings, and it has worked..
If it works, then add small capacitence, and test..
Or like Ben says, use 10Mhz Xtal, and pll, at least that should work..
You dont have to remove internal osc config, just change the the osc config at HS or HSPLL on the PPP, and chip uses external osc.

Mika

Post Reply