CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Beginer needs help for PIC18F4550 !

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
beginer
Guest







Beginer needs help for PIC18F4550 !
PostPosted: Thu Sep 13, 2007 2:32 am     Reply with quote

Hi all,
I am a beginer, and now trying run a simple program for PIC18F4550.
I use the PICSTART PLUS Programmer and try to run the "LED Blink" program, but i tried so many times and it does not work.
Here is my code:

#include<18F4550.h>
//#fuses NOWDT,PUT,HS,NOPROTECT
#use delay(clock=8000000)
void main(void)
{
while(TRUE)
{
output_high(PIN_A2);
output_high(PIN_B2);
output_high(PIN_C2);
delay_ms(100);
output_low(PIN_A2);
output_low(PIN_B2);
output_low(PIN_C2);
delay_ms(100);
}
}

3 LEDs are connected to PinA2, B2, C2. And for the PIC Schematic, i just connected the MCLR to the 5V through a Resistor 1K, Vdd to 5V, Vss to Gnd, That's all.
Anybody can help me to show the error and show me how to make it work?
I have searched the same program but i am so confused and can not recognize the differrence.
Thanks!
grasspuddle



Joined: 15 Jun 2006
Posts: 66

View user's profile Send private message

PostPosted: Thu Sep 13, 2007 6:46 am     Reply with quote

HS means an external oscillator. You need to connect an 8mhz crystal or resonator. Try changing the HS to the internal (i think the fuse is INTRC but look it up) and using the setup_oscillator(8mhz); command in the beginning.

edit: i'm just guessing the commands based on the pics i've worked with (452/4520 mostly)
jfk1965



Joined: 21 Oct 2003
Posts: 58

View user's profile Send private message

PostPosted: Thu Sep 13, 2007 8:58 am     Reply with quote

do you have current limiting resitors in series with your LED's?
Also try a 100nF capacitor from MCLR to ground.

JFK
rnielsen



Joined: 23 Sep 2003
Posts: 852
Location: Utah

View user's profile Send private message

PostPosted: Thu Sep 13, 2007 9:04 am     Reply with quote

Try these fuses:

#fuses INTRC_IO,NOWDT,PUT,STVREN,NOLVP,NOPBADEN,NOFCMEN,MCLR
beginer
Guest







Thank you, Guys!
PostPosted: Thu Sep 13, 2007 11:10 pm     Reply with quote

Thank all you guys, i used the 8mhz external Crystal Oscillator and now it works.
But i still wondered why when i used #fuses INTRC_IO or whatever related to internal osc, it said that: error with unknown keyword #Fuses "INTRC".
Anyway now i can continue doing my work.
Thanks once again for all your help!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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