![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
cagabit
Joined: 19 Dec 2014 Posts: 7
|
CCS compiler & MPLAB X ->data types mixing |
Posted: Mon Jan 12, 2015 12:38 am |
|
|
Hi,
Stuck with a project, using CCS compiler 5.015 with MPLAB X 2.26
This combination is forced itself since trying to debug PIC 24FJ128GB206, couldn't manage to work with ICD-U40 ( v5 ! ) and also pickit3 with CCS IDE. So trying to solve this bottle neck with CCS + MPLAB + pickit3.
Because of the data types defined in CCS before , (actually they were fine under CCS IDE ) , some strange behavior started under MPLAB IDE;
- "If" is not working like var1 is defined as int16
- type conversions is not working var1 defined int
When I try to change the variable definitions as;
int -> unsigned char
int16 -> unsigned int
still have problems which mixes everything.
Can anyone please guide me on this, read both compilers data types but couldn't figure it out ! As far as I understand MPLAB intervene to the compile process, so my old code working under CCS IDE is not fine anymore.
Maybe I am missing a CCS compiler directive, working under MPLAB ?
Thanks. |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19378
|
|
Posted: Mon Jan 12, 2015 1:45 am |
|
|
An int is not a char.
On the DsPIC's, an int, defaults to an int16.
If you change your int definition to char, then 'of course' a comparison with 1023 is not going to work (char == int8).
Try using MPLAB, rather than MPLAB-X. MPLAB-X, is 'unfortunate', I have had to use it, but have yet to see a release that actually fully works. It actually makes CCS's 'bugs' look minor. MPLAB 8.92, is currently the 'best' debugger around, provided your chip is supported (yours is).
Yes, MPLAB _will_ interfere with the compile process _if you have debug mode selected_. It won't otherwise, but then you can't debug. It defaults to debug mode.
With the some compilers, the comment in the CCS 'readme', is wrong. They say that integers default to unsigned, but in fact on some versions the default is signed. This gives some oddities like you are experiencing, with (for instance), an 'int' that increments past 32767, automatically being treated as a -ve number. This may be your core problem. |
|
![](templates/subSilver/images/spacer.gif) |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|