Jump to content
raskolnikov

Crystal Oscillator Setup

Recommended Posts

Forum,

 

I can't seem to get a 20MHz crystal oscillator to work with my PIC18F4685. I have to believe that it is a configuration issue. This is the current configuration:

 

#pragma DATA _CONFIG1H, _OSC_HS_1H

#pragma DATA _CONFIG2H, _WDT_OFF_2H

#pragma DATA _CONFIG3H, _MCLRE_OFF_3H

#pragma DATA _CONFIG2L, _BOREN_OFF_2L & _PWRT_OFF_2L

#pragma CLOCK_FREQ 20000000

 

When I program the u-controller and power it up it will work with or without the crystal hooked to it which tells me that it is defaulting to some internal oscillator. Perhaps there is some setting I am missing.

 

Best,

 

Matt

Share this post


Link to post
Share on other sites

Hi Matt,

 

If you don't specify config bits, SourceBoost tends to set them to '1'. Although you have only specified _OSC_HS_1H in CONFIG1H, you also have FCMEN bit set which enables the failsafe oscillator to kick in should the HS oscillator fail which is possibly what you are seeing.

 

Also make sure the extended instruction set is NOT enabled if you change CONFIG4L.

 

Cheers

 

Reynard

Share this post


Link to post
Share on other sites

Your content will need to be approved by a moderator

Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×