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 support@ccsinfo.com

(SOLVED) ...Configuration/initialization.

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



Joined: 02 Nov 2007
Posts: 26

View user's profile Send private message

(SOLVED) ...Configuration/initialization.
PostPosted: Fri May 30, 2008 3:48 pm     Reply with quote

Hi...

I have a question about configuration...

I wrote a C code for the PIC18F2520 that works okay. Since i also own some 18F2550 and 18F2685 (DIP28), i tried recompiling the code for those PIC's (by changing the processor type in the #include line). The compiling worked okay (i had more than enough Flash and RAM space), no overclocking (i use internal RC osc.) and no error/warning messages from the compiler.

However, when i try the project on board, nothing works, either on the 2685 or the 2550.

Personally i highly suspect bad configuration/initialization in my code.

My questions:

- Is there a place on the Net where i could find some sample
config/initialization code for every PIC model? So,
i could easily review my own code and find the missing lines

- Is there a way to render the compiler more "error sensitive" so
i could get more error messages? This way, if i forget
something, i could much more easily find my faults and
correct them.

PIC controllers do have MANY options/features that change from PIC to PIC. And trying to get them all by heart is an impossible task and i'd like a lot to be able to write PIC to PIC transportable code. That will be a proof to myself that i have well built code.

Thanks!

Reginald


Last edited by PICman on Thu Jun 05, 2008 3:38 pm; edited 1 time in total
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri May 30, 2008 4:07 pm     Reply with quote

Compare the pinouts in the Overview sections of the 18F2520 and
18F2550. There are several important differences in the features
assigned to the pins. The 18F2550 has a USB module and has
some pins changed and/or dedicated to that module. It's not
a drop-in replacement for the 18F2520.
PICman



Joined: 02 Nov 2007
Posts: 26

View user's profile Send private message

PostPosted: Thu Jun 05, 2008 3:49 pm     Reply with quote

I found the way to solve the problem:

I start a whole new fake project for the controller i use, but use the PIC WIZARD to start my project with all the options i want (and do not want)...instead of starting the code all by myself.

Once the PIC WIZARD configuration is finished, i close the fake project (without even writing a single line of code in it.), then "steal" the configuration/initialization code written for the controller in the fake project and add it to my real project.

My main problem was that i started to write code without using the wizard. This is feasible with smaller controllers which have a few options, but when it comes to the larger PIC18 engines (which have A LOT of options) this is not possible. You have to use the wizard.
Ken Johnson



Joined: 23 Mar 2006
Posts: 197
Location: Lewisburg, WV

View user's profile Send private message

PostPosted: Fri Jun 06, 2008 7:23 am     Reply with quote

Well, I never use the wizard - just create a project based on a simple main .c file. Then look at the bottom of the .lst file, check the (default) fuse settings, add what's needed, then add the setup_whatever to get the configuration I need. But that's just me . . .

Ken
Ttelmah
Guest







PostPosted: Fri Jun 06, 2008 9:25 am     Reply with quote

Ditto.
I think you really have to spend a while on any PIC, and more on the newer chips, studying what the various multiplexed options on the pins, and the oscillator in particular really do. The Wizard, tends to generate quite a lot of unnecessary settings, and gets others blatantly wrong.... :-(

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
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