View previous topic :: View next topic |
Author |
Message |
DireSpume
Joined: 07 Jan 2013 Posts: 31
|
CCS in MPLAB X -- syntax underlining, etc |
Posted: Mon Jan 07, 2013 6:48 pm |
|
|
I am new to the CCS compiler, and decided to use it in from within the MPLAB X IDE since it has some spiffy features that the CCS IDE doesn't. However, I'm a little disappointed that the IDE appears to have no knowledge of any of the CCS functions or special identifiers (e.g. setup_timer_0(), #use, true), as there is no header file that I can find with all the function prototypes -- I guess these functions are embedded in the compiler and so don't need to be defined in a header file? Unfortunately this makes the IDE underline these functions and keywords as unresolved identifiers, and of course auto complete is off the table as well. So my question is, does anybody know a trick to fix this, or do I just have to live with it? Thanks! |
|
|
jeremiah
Joined: 20 Jul 2010 Posts: 1346
|
|
Posted: Wed Jan 09, 2013 7:46 pm |
|
|
I find them annoying as well. What I do is make my own function prototypes for the CCS built ins. Note that they prototypes only have to have the same name as the built in to stop the underlining. You can use void return type and no parameters in your prototype.
So stuff like:
Should be sufficient. I will say I haven't tried in a while though so I don't know if MPLABX 1.51 still falls for this trick. |
|
|
DireSpume
Joined: 07 Jan 2013 Posts: 31
|
|
Posted: Wed Jan 09, 2013 8:05 pm |
|
|
Looks like it still works, thanks! |
|
|
DireSpume
Joined: 07 Jan 2013 Posts: 31
|
|
Posted: Mon Jan 14, 2013 2:03 pm |
|
|
I called CCS technical support, and they said that this issue is a bug with MPLAB X, and that they are just waiting for Microchip to fix it. |
|
|
Diego López
Joined: 25 May 2012 Posts: 11 Location: Colombia
|
|
Posted: Sun Jan 20, 2013 6:05 pm |
|
|
Hello friends, I excuse the language.
MplabX not recognize CCS functions, you can do something?
|
|
|
jeremiah
Joined: 20 Jul 2010 Posts: 1346
|
|
Posted: Sun Jan 20, 2013 7:19 pm |
|
|
My first reply shows a way to handle functions. For variables, you can probably do some #define trickery or extern trickery, but I haven't tried that yet. |
|
|
dezso
Joined: 04 Mar 2010 Posts: 102
|
|
Posted: Mon Jan 21, 2013 12:43 am |
|
|
Go to...
Tools->Options->C/C++->deselect "Highlight Unresolved Identifiers" _________________ I'm could be wrong many time's, at least I know what I'm doing |
|
|
Diego López
Joined: 25 May 2012 Posts: 11 Location: Colombia
|
|
Posted: Mon Jan 21, 2013 8:13 am |
|
|
Hello friends
thanks for replying,
1:
I defined functions, but there are many
Example: void delay_ms ()
I do not know how to define other functions Example: int_timer0
2:
Go to ...
Tools-> Options-> C / C + + -> deselect "Highlight Unresolved Identifiers"
It works, but then I can not see errors, subsequent
best regards |
|
|
jeremiah
Joined: 20 Jul 2010 Posts: 1346
|
|
Posted: Mon Jan 21, 2013 10:37 am |
|
|
Diego López wrote: |
1:
I defined functions, but there are many
Example: void delay_ms ()
I do not know how to define other functions Example: int_timer0
|
Same as I mention above:
void int_timer0();
Should work for all functions.
void <insert_function_name_here>(); |
|
|
Diego López
Joined: 25 May 2012 Posts: 11 Location: Colombia
|
|
Posted: Mon Jan 21, 2013 10:43 am |
|
|
jeremiah, now I understand, thank you very much. |
|
|
Jeff King
Joined: 20 Oct 2003 Posts: 43 Location: Hillsdale, Michigan USA
|
|
Posted: Fri Mar 22, 2013 12:50 pm |
|
|
jeremiah wrote: | I find them annoying as well. What I do is make my own function prototypes for the CCS built ins. Note that they prototypes only have to have the same name as the built in to stop the underlining. You can use void return type and no parameters in your prototype.
So stuff like:
Should be sufficient. I will say I haven't tried in a while though so I don't know if MPLABX 1.51 still falls for this trick. |
So this would just be an include .h file making these prototypes?
Anyone put something like this together with all the CCS functions and might be willing to share? Hate typing something someone else already did ;-) Sounds like a good include for the CCS release as well. |
|
|
jeremiah
Joined: 20 Jul 2010 Posts: 1346
|
|
Posted: Fri Mar 22, 2013 2:17 pm |
|
|
yeah, you can make it an include file if needed. I've never used enough of them to motivate myself to make an all encompassing file. Not to mention I don't have enough different chips to test against to ensure everything works fine with the dummy includes (should in theory be no issue).
If someone were to go through the process of making and verifying it, it would be a nice addition to the code library. |
|
|
|