PIC18F452 crystal problem

Status
Not open for further replies.

abdoalghareeb

Member level 5
Joined
Feb 5, 2010
Messages
84
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,981
HI................................................ ................
I use PIC 18f452 , mikroC compiler , WinPic800 and jmd programmer.
and I wrote this simple code for led blinking on PORTA.0
I use Crystal Oscillator as clock source
My problem is : my controller does not run with high frequency Crystal .
I tried several values (4 MHz,8 MHz,16 MHz,20 MHz,25 MHz).Only 4 MHz and 8 MHz worked
I tried all Oscillator setting of the controller, just HS + PLL worked

 

For higher frequency crystals, HS should work.

PORTA0 (along with other PORTA pins) is multiplexed with the ADC. So, to use it as a digital output, you should disable the ADC, by adding this line:
Code:
ADCON1 = 7;
or
Code:
ADCON1 = 6;

Hope this helps.
Tahmid.
 

I added the line :

ADCON1 = 0x07;

Also I tried to change the output (PORTD.0)

But it is not run with high frequency
 

So, with 16MHz and 20MHz crystals, with HS setting, nothing happens? The LED doesn't blink or light at all? Just stays turned off?

Is there sufficient decoupling? Connect 0.1uF capacitors between all VDD and VSS lines.
 
It looks like you have traces on the PCB going between the crystal and the PIC. Crossing over the crystal tracks with other tracks (obviously on different layers) or having tracks routed between the crystal pins can sometimes cause problems. These are worse at higher frequencies.

I am not saying that is your issue, but it is best to avoid such things.
 

I connect two 0.1uF capacitors between all VDD and VSS lines.
It is working thanksss...

but it just works with (HS + PLL) mode and does not work with (HS) mode or any other mode.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…