18F4431 40MHz Crystal frequency

Status
Not open for further replies.

dmta

Member
Hi all,

What should I do to operate a 18F4431 at 40MHz?

I tried using a 10MHz crystal with 2x22pF caps with the "HS oscillator, PLL enabled (clock frequency=4XFOSC1)" but it didn't work [I blinked an LED with 1Hz and the timing was all wrong].

I used a 4MHz with the same option but it also gave me the same result.

The pic works fine with a 20MHz crystal at HS mode.

What have I done wrong? Here is the bit configuration that I used

Regards
 

Attachments

  • 40M.JPG
    81.4 KB · Views: 185
Thank you both for replying. I am using mikroc pro for pic v5.61

Code:
void main(){

     TRISC.F7 = 0;

     while(1){

              PORTC.F7 = 0;
              delay_ms(1000);
              PORTC.F7 = 1;
              delay_ms(1000);

     }

}
 
What speed does the LED blink?
How does the compiler know what frequency you are operating at?

BTW, the code you posted will produce a 0.5Hz flash.

Mike.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…