|
|
View previous topic :: View next topic |
Author |
Message |
James Boo
Joined: 09 Nov 2006 Posts: 1
|
PIC 18F4550 clock frequency problems |
Posted: Thu Nov 09, 2006 2:34 pm |
|
|
I am working with an 18F4550. For the #FUSES, I have selected
#FUSES HS, NOPROTECT, NOLVP, NOBROWNOUT, NOWDT, NOMCLR, NOPUT
With this setting, the PIC is completely unresponsive--it just doesn't work. When I change the #fuses settings to:
#FUSES HS, INTRC, NOPROTECT, NOLVP, NOBROWNOUT, NOWDT, NOMCLR, NOPUT
The PIC works, but the frequency is way too slow for what I need it to do. How do I get it to work at 8MHz frequency? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Nov 09, 2006 3:25 pm |
|
|
Here is a test program for the 18F4550 that runs off the internal
oscillator at 8 MHz. I tested this with PCH vs. 3.249 on a PicDem2-Plus
board.
Code: |
#include <18F4550.h>
#fuses INTRC_IO, NOWDT, PUT ,BROWNOUT, NOLVP
#use delay(clock=8000000)
//============================
void main()
{
while(1)
{
output_high(PIN_B0);
delay_ms(500);
output_low(PIN_B0);
delay_ms(500);
}
} |
|
|
|
Ttelmah Guest
|
|
Posted: Thu Nov 09, 2006 3:31 pm |
|
|
Without knowing what type of oscillator you want to use, it'll be a guess. HS, _requires_ an external crystal. If you do not have one, get rid of it. INTRC, implies operation with the internal oscillator.
#FUSES INTRC, NOPROTECT, NOLVP, NOBROWNOUT, NOWDT, NOMCLR, NOPUT
#use delay(clock=8000000)
Should normally give you 8MHz. However on some compilers, you may need to have the line:
setup_oscillator(OSC_8MHZ);
Near the start of the main (the compiler should generate this internally, automatically if the correct 'delay' statement is present, but it is safer to include it yourself).
Best Wishes |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|