![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
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);
}
} |
|
|
![](templates/subSilver/images/spacer.gif) |
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 |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|