PIC header files

Thread Starter

Sparky49

Joined Jul 16, 2011
833
Just to confirm, a project basis is what's created after using the project wizard/new project on the startup screen?

If I use that, then I shouldn't need to mention header files at all in my program? If so I can just remove the #include line altogether?

Apologies for my slow grasp, uni taught us how to do things, but not what was going on outside of the main program area.

Regards,

Sparky
 

t06afre

Joined May 11, 2009
5,934
Just to confirm, a project basis is what's created after using the project wizard/new project on the startup screen
Yes that is correct. Using the wizard is a good way to build a project/ working on project basis. Regrading the device specific header file. So is it true at least for XC8 compiler. I have not used the C18 compiler so I do not know. However this also something you should repeat 10 times. If you use the XC8 compiler. Every program you write should have this line
Rich (BB code):
#include <xc.h>
 

Thread Starter

Sparky49

Joined Jul 16, 2011
833
Okay, phew. I have been using the wizard so that's okay. :)

From now on, I'll use MPLABX with XC8 compiler (for C programs).

I've created a new project, and put a source file in the Source Files folder, so all should be good. :) I've replaced the header with the one above, however it is still telling me that I'm using illegal directives (fuses and use).

I had a read of the configuration section of the datasheet (here) (table 25.1) however I could not find anything resembling HS, NOLVP, NOWDT, NOPROTECT.

Also, please excuse my ignorance, but aren't the datasheets written for asm? What perplexes me is that I thought C (at least amongst the same family of microcontrollers) should be pretty much universal?

I might consider making a video, because I am probably missing a checkbox or I haven't clicked on a menu. :p

Regards,

Sparky
 

Thread Starter

Sparky49

Joined Jul 16, 2011
833
Well I tried building it for a P18F4520 (as in the original case) as the same errors appeared. So I presume that means it is something wrong with the program?

Sparky
 

t06afre

Joined May 11, 2009
5,934
A program written for C18. Will not work without some rewriting on XC8. You are also wrong about the your impression on that the datasheet will only be valid for assembler. Using assembler or C the same registers have to be set correctly in order for the PIC to work as wanted.
 
Top