CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Problems porting code from Keil C51

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ckuecker



Joined: 15 Mar 2011
Posts: 3
Location: Beloit, WI USA

View user's profile Send private message Send e-mail Visit poster's website

Problems porting code from Keil C51
PostPosted: Thu Mar 17, 2011 12:08 pm     Reply with quote

Hello,

I have working code from an 8051 project that I need to port over to a PIC8=18F87J72 processor. I figured out some of the issues already, but on compiling under CCS, I am seeing many errors like this:

In the .h file:
Code:

116 extern unsigned int16 sleep_timeout; // Master delay time (seconds)
117 extern unsigned int16 sleep_count;   // Sleep / discover transmit count
118 extern unsigned int16 flash;      // LED flasher timer
119 extern unsigned int16 bat_time;      // Battery check timer


*** Error 38 "C:\Code\xbee.h" Line 117(34,35): This type can not be qualified with this qualifier
*** Error 43 "C:\Code\xbee.h" Line 117(34,35): Expecting a declaration
*** Error 38 "C:\Code\xbee.h" Line 119(31,32): This type can not be qualified with this qualifier
*** Error 43 "C:\Code\xbee.h" Line 119(31,32): Expecting a declaration

Declarations in the .c file:
Code:

unsigned int16 sleep_count;       // Sleep / discover transmit count
unsigned int16 xlength;         // Reply string length
unsigned int16 flash;              // LED flash timer
unsigned int16 bat_time;         // Battery check timer

I don't see the error. 'extern', 'unsigned', and 'int16 are all good types in CCS C as far as I can see.

Any ideas?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Mar 17, 2011 12:17 pm     Reply with quote

I think you can use 'extern' if you have the CCS IDE and if you have
enabled it to compile with "multiple compilation units". I don't have the
IDE, I have the command line compilers, so I don't have any experience
with that. Here are two previous threads on converting Hitech C code
to CCS. They may provide help with converting the Keil code:
http://www.ccsinfo.com/forum/viewtopic.php?t=37649
http://www.ccsinfo.com/forum/viewtopic.php?t=36828
ckuecker



Joined: 15 Mar 2011
Posts: 3
Location: Beloit, WI USA

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Thu Mar 17, 2011 3:11 pm     Reply with quote

Did some digging in the CCS manual. "Multiple Compilation Units" gives an example of how to run the command line compiler as a linker, after including the +EXPORT option on each compiler invocation.

I'm going to look into getting that to happen through MPLAB, which I want to continue using for ease of debugging.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Mar 17, 2011 3:40 pm     Reply with quote

This CCS FAQ on multiple compilation units has a section on MPLAB:
http://www.ccsinfo.com/faq.php?page=multi_comp_units
ckuecker



Joined: 15 Mar 2011
Posts: 3
Location: Beloit, WI USA

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Thu Mar 17, 2011 3:48 pm     Reply with quote

I'm screwed. I bought the PCH compiler, not the PCW or IDE versions, and that FAQ specifically says I can't do it with this program.

I really wish that limitation had been explicitly called out in the description of the product. Unless I can upgrade this copy, I've wasted $200.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Mar 17, 2011 3:56 pm     Reply with quote

You still compile the files by using the conventional CCS method:
http://www.ccsinfo.com/forum/viewtopic.php?t=18649&start=1
Only the main source file for the project is "added" to the Source Files
list in the MPLAB project window. All other files are added to the project
with an #include line in the main source file.

If you have source files for each file (and not just object files), then you
can do it this way. However, you will have to edit the files and get rid of
the 'extern' keywords, etc.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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