View previous topic :: View next topic |
Author |
Message |
PICman
Joined: 02 Nov 2007 Posts: 26
|
(SOLVED) ...Configuration/initialization. |
Posted: Fri May 30, 2008 3:48 pm |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri May 30, 2008 4:07 pm |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
PICman
Joined: 02 Nov 2007 Posts: 26
|
|
Posted: Thu Jun 05, 2008 3:49 pm |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
Ken Johnson
Joined: 23 Mar 2006 Posts: 197 Location: Lewisburg, WV
|
|
Posted: Fri Jun 06, 2008 7:23 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
|
Posted: Fri Jun 06, 2008 9:25 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
|