Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Clarification on the header file

Status
Not open for further replies.
I have seen in many microchip programs the following code
Code:
#if defined(__dsPIC33F__)
#include "p33Fxxxx.h"
#elif defined(__PIC24H__)
#include "p24Hxxxx.h"
#endif
But where are these __dsPIC33F__ or __PIC24H__ will be defined. In which file should I look into?
 
With XC8/16/32 compilers, you only need XC.h as the processor type is obtained from the IDE and then XC8 /16/32 then produces an AS file ( assembly startup ) which defines the processor..

Most compilers used to allow ( and still do ) the inclusion of the correct header... XC8 and MikroC both do not need this to be defined..
 
So in case if i import any sample project i should select the correct controller for that project then it automatically includes that header. Am i correct?
 
Like I said... XC8 and MikroC allow automatic processor selection... I can't assume you are using a specific compiler / IDE.. MPIDE will pass the processor type to the compiler.. If you just include XC.H then it will auto detect. However! You can just specify the header by name.. ie.. #include <p24Hxxxx.h> and it will be found.. This is to simplify the coding process to the masses..
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top