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

RS232 , PIC18F2550 don't working
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
temtronic



Joined: 01 Jul 2010
Posts: 9658
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Feb 02, 2012 1:39 pm     Reply with quote

this works for the 18F4550.....
Code:

#include <18f4550.h>
#FUSES HS
#FUSES NOWDT                     //No Watch Dog Timer
#FUSES WDT128                    //Watch Dog Timer uses 1:128 Postscale
#FUSES NOPROTECT                 //Code not protected from reading
#FUSES NOBROWNOUT                //No brownout reset
#FUSES BORV20                    //Brownout reset at 2.0V
#FUSES PUT                       //Power Up Timer
#FUSES MCLR                      //Master Clear pin enabled

#FUSES NOCPD                     //No EE protection
#FUSES NODEBUG                   //No Debug mode for ICD
#FUSES NOLVP                     //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOWRT                     //Program memory not write protected
#FUSES NOWRTD                    //Data EEPROM not write protected
#FUSES NOWRTB                    //Boot block not write protected
#FUSES NOEBTR                    //Memory not protected from table reads
#FUSES NOEBTRB                   //Boot block not protected from table reads
#FUSES NOCPB                     //No Boot Block code protection
#FUSES NOWRTC                    //configuration not registers write protected

#FUSES NOFCMEN                   //Fail-safe clock monitor enabled
#FUSES NOPBADEN                  //PORTB pins are configured as digital I/O on RESET

#fuses PLL1
#FUSES CPUDIV1                   //System Clock by 1
#FUSES USBDIV                    //USB clock source comes from PLL divide by 2
#FUSES VREGEN                    //USB voltage regulator enabled

#FUSES ICPRT                     //ICPRT enabled
#FUSES STVREN                    //Stack full/underflow will cause reset
#FUSES NOIESO                    //Internal External Switch Over mode enabled
#FUSES LPT1OSC                   //Timer1 configured for low-power operation
#FUSES NOXINST                   //Extended set extension and Indexed Addressing mode disabled (Legacy mode)


#use delay(clock=20000000)
.....
Chaud



Joined: 11 Jan 2012
Posts: 39

View user's profile Send private message

PostPosted: Thu Feb 02, 2012 2:25 pm     Reply with quote

Temtronic it worked !!!!!!!!!! with F4550 :D can you provide me a list like that for PIC18F2550? Thanks dude :D
temtronic



Joined: 01 Jul 2010
Posts: 9658
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Feb 02, 2012 2:54 pm     Reply with quote

Sorry but I don't have a 2550 to 'play' with..

Since it works...just copy and paste...

I saved this 'fuses configuration' as a file called '4550fuses.c' and put it in the beginning of my 4550 programs,like loading device drivers.That way my main program isn't 'cluttered' with code I lready know is good.
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Thu Feb 02, 2012 3:07 pm     Reply with quote

#FUSES are listed in the device file

18F2550.h

and explained ( more or less) in the pic 18f2550 DATA SHEET.

I think I have a 4550 in my parts sample cabinet but never tried it for anything -- &&
as I said I have never worked with the chip in question and hope I never have to ......
Chaud



Joined: 11 Jan 2012
Posts: 39

View user's profile Send private message

PostPosted: Thu Feb 02, 2012 3:48 pm     Reply with quote

I used same fuses on 2550 and its working, thanks for all help, you guys are great Smile
Ttelmah



Joined: 11 Mar 2010
Posts: 20161

View user's profile Send private message

PostPosted: Thu Feb 02, 2012 4:12 pm     Reply with quote

Some comments inline:
Code:

#include <18f4550.h>
#FUSES HS
//Select the HS oscillator, and that the CPU is to come from this, not the PLL

#FUSES NOWDT                     //No Watch Dog Timer
//Turn off the watchdog

#FUSES WDT128                    //Watch Dog Timer uses 1:128 Postscale
//Does nothing, since the watchdog is disabled.....

#FUSES NOPROTECT                 //Code not protected from reading
//Turn off memory protection - good idea for development, may need
//changing in a production version.

#FUSES NOBROWNOUT                //No brownout reset
//Turn off brownout - personally I'd have this on

#FUSES BORV20                    //Brownout reset at 2.0V
//Again does nothing since the brownout is disabled. Given that the chip
//_requires 4.2v to meet it's specs, I'd have brownout enabled, and this
//set to 4.3v - there is a fault in some compiler versions that the 4.3v
//setting isn't available though.....

#FUSES PUT                       //Power Up Timer
//Good idea ensures the clock really is stable before starting - delays
//for a tiny moment when starting

#FUSES MCLR                      //Master Clear pin enabled
//Enables the MCLR pin - obviously use NOMCLR if you want the pin for
//something else.

#FUSES NOCPD                     //No EE protection
#FUSES NODEBUG                   //No Debug mode for ICD
//Protection and debug.

#FUSES NOLVP                     //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
//99.9% of programmers want this as 'NOLVP' if not you _must_ ensure
//these lines cannot float or the chip will not run.....

#FUSES NOWRT                     //Program memory not write protected
#FUSES NOWRTD                    //Data EEPROM not write protected
#FUSES NOWRTB                    //Boot block not write protected
#FUSES NOEBTR                    //Memory not protected from table reads
#FUSES NOEBTRB                   //Boot block not protected from table reads
#FUSES NOCPB                     //No Boot Block code protection
#FUSES NOWRTC                    //configuration not registers write protected
//Yet more protection fuses.....

#FUSES NOFCMEN                   //Fail-safe clock monitor enabled
//Actually _disabled_ NO fail safe clock monitor.
//If this is set (FCMEN), chip will run even if the clock doesn't start, but
//using the internal oscillator as a 'fallback'. Needs careful code to check
//if this has happened, or some really silly results will be seen....

#FUSES NOPBADEN                  //PORTB pins are configured as digital I/O on RESET
//Common problem, since this is one of the few chips where some pins
//wake up as ADC by default. This fuse avoids problem.

#fuses PLL1
//Wrong. Won't matter if not using USB, but needs to be PLL5 for USB
//to work from 20MHz.

#FUSES CPUDIV1                   //System Clock by 1
//CPU undivided - from 20MHz.

#FUSES USBDIV                    //USB clock source comes from PLL divide by 2
#FUSES VREGEN                    //USB voltage regulator enabled
//These two fuses are unnecessary unless using USB, which won't work
//because the PLL is wrong.....

#FUSES ICPRT                     //ICPRT enabled
#FUSES STVREN                    //Stack full/underflow will cause reset
//Generally essential. A stack overflow without this _will_ lead to
//indeterminate behaviour.

#FUSES NOIESO                    //Internal External Switch Over mode enabled
//Actually _disabled_....

#FUSES LPT1OSC                   //Timer1 configured for low-power operation
#FUSES NOXINST                   //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
//Essential or the compiler won't work

#use delay(clock=20000000)


Best Wishes
Chaud



Joined: 11 Jan 2012
Posts: 39

View user's profile Send private message

PostPosted: Thu Feb 02, 2012 7:19 pm     Reply with quote

Thanks dude, I wanted some explanation like this Smile
Ttelmah



Joined: 11 Mar 2010
Posts: 20161

View user's profile Send private message

PostPosted: Fri Feb 03, 2012 2:21 am     Reply with quote

As one other comment, in the compiler directory, there is a file 'fuses.txt', which gives the 'text' translation of every fuse name for all the chips!. Combine with the data sheet, and you have a start on 'what the fuses do'...

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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