View previous topic :: View next topic |
Author |
Message |
jackhab
Joined: 03 Apr 2019 Posts: 6
|
Header file for built-in function |
Posted: Wed Apr 03, 2019 11:27 am |
|
|
I just started using CCS with MPLAB X.
Is there a header with all built-in functions and defines so that I can get rid of unresolved identifiers in the IDE?
If not, is there some kind of a list of this built-in API? What kind of a reference you usually use?
Thanks. |
|
![](templates/subSilver/images/spacer.gif) |
PrinceNai
Joined: 31 Oct 2016 Posts: 463 Location: Montenegro
|
|
![](templates/subSilver/images/spacer.gif) |
dluu13
Joined: 28 Sep 2018 Posts: 395 Location: Toronto, ON
|
|
Posted: Wed Apr 03, 2019 11:52 am |
|
|
If you are in windows, in the PICC start menu folder, the help file is the manual. |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
Re: Header file for built-in function |
Posted: Wed Apr 03, 2019 12:18 pm |
|
|
jackhab wrote: |
Is there a header with all built-in functions and defines so that I can get rid of unresolved identifiers in the IDE?
|
The .h file for your PIC lists all the built-in functions.
For example, the 18F46K22.h file starts with:
Code: | // Discrete I/O Prototypes:
_bif void set_tris_a(int8 value);
_bif void set_tris_b(int8 value);
_bif void set_tris_c(int8 value);
_bif void set_tris_d(int8 value);
_bif void set_tris_e(int8 value);
|
"bif" stands for "built-in function". |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19372
|
|
Posted: Thu Apr 04, 2019 1:28 am |
|
|
and, since you should be including that file at the start of each project,
MPLAB should not be giving you unresolved identifiers....
A CCS program should always start with:
Code: |
#include "processor.h" //where processor is the PIC you are using
//Then fuses
//clock settings
//select peripherals if your chip use this
//then #uses for USART, I2C etc.
//Then include library functions required
//Then the actual code.
|
Including the processor file as the first line of your program then tells
everything following what features are supported (and tells MPLAB about
the CCS functions). Then the fuses and clock should be setup before
anything else.
Doing things in this order (or very slight variants - in some cases a fuse
setting may be needed after the clock), makes sure that things are
correctly sequenced.
![Very Happy](images/smiles/icon_biggrin.gif) |
|
![](templates/subSilver/images/spacer.gif) |
jackhab
Joined: 03 Apr 2019 Posts: 6
|
Re: Header file for built-in function |
Posted: Thu Apr 04, 2019 1:57 am |
|
|
PCM programmer wrote: | jackhab wrote: |
Is there a header with all built-in functions and defines so that I can get rid of unresolved identifiers in the IDE?
|
The .h file for your PIC lists all the built-in functions.
For example, the 18F46K22.h file starts with:
Code: | // Discrete I/O Prototypes:
_bif void set_tris_a(int8 value);
_bif void set_tris_b(int8 value);
_bif void set_tris_c(int8 value);
_bif void set_tris_d(int8 value);
_bif void set_tris_e(int8 value);
|
"bif" stands for "built-in function". |
This is interesting because PIC headers in my PICC directory does not have any _bif functions in them at all, including of course 18F45K22.h I'm building the project with.
In general this is the first time I encounter C API without a header file declaring all its functions. |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19372
|
|
Posted: Thu Apr 04, 2019 3:18 am |
|
|
That means you have a very old compiler. The bif definitions were introduced
with the V5 compiler, in about 2013.
There was a list of at least some prototypes for MPLAB published here
before that. Problem is going to be working out what the thread was
called that had these. |
|
![](templates/subSilver/images/spacer.gif) |
jackhab
Joined: 03 Apr 2019 Posts: 6
|
|
Posted: Sat Apr 06, 2019 10:11 am |
|
|
Ttelmah wrote: | That means you have a very old compiler. The bif definitions were introduced
with the V5 compiler, in about 2013.
There was a list of at least some prototypes for MPLAB published here
before that. Problem is going to be working out what the thread was
called that had these. |
That's right - I have version 4. I'll check if I can get the headers from evaluation version of version 5.
Thanks. |
|
![](templates/subSilver/images/spacer.gif) |
jeremiah
Joined: 20 Jul 2010 Posts: 1329
|
|
Posted: Sat Apr 06, 2019 2:42 pm |
|
|
jackhab wrote: | Ttelmah wrote: | That means you have a very old compiler. The bif definitions were introduced
with the V5 compiler, in about 2013.
There was a list of at least some prototypes for MPLAB published here
before that. Problem is going to be working out what the thread was
called that had these. |
That's right - I have version 4. I'll check if I can get the headers from evaluation version of version 5.
Thanks. |
There might be some incompatibilities for some chips as CCS did a set of sweeping changes to various names for some chips in v5. If things don't work out, you can always manually add those _bif lines to your header file manually using the format that PCM Programmer's post shows. |
|
![](templates/subSilver/images/spacer.gif) |
|