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

joining two different projects

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



Joined: 29 May 2008
Posts: 8

View user's profile Send private message

joining two different projects
PostPosted: Mon Sep 22, 2008 5:29 am     Reply with quote

is it possible to join two different projects? is there any way about doing this?
i have two working project, i want to join them in a third project.

i tried to explain as shown below:



NOTE: all content of files in both projects (*.c, *.h) are different
(ignore that same names were used)
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Sep 22, 2008 2:16 pm     Reply with quote

Make a new project. In your new main project file (.c), use #ifdef, #else,
#endif to select the code which will be compiled for a particular version.
mutevaggil



Joined: 29 May 2008
Posts: 8

View user's profile Send private message

pre processor
PostPosted: Tue Sep 23, 2008 7:11 am     Reply with quote

if i am not wrong, these pre-proccessor instructions work only while compling.

i want user can change which project works. i mean, when i press Button A,
project1 will work, when i press button B, it will stop and project2 wil start to work.


Ttelmah
Guest







PostPosted: Tue Sep 23, 2008 7:49 am     Reply with quote

The first (memory efficient) way, is to rewrite the two projects into one. Rename all functions with the same name, into different named versions, and name the 'main' routines, as perhaps 'main1', and 'main2'. Then just have a loader, which checks for the button, and runs either main1, or main2.
The second way, is to build the two projects separately. Use the #build directive, and #org to put them into different parts of the memory. Just as you do for a project that runs with a bootloader (look at the bootloader examples for how to compile the main routines). Then just as with the bootloader, you have your 'keyboard' code, where the bootloader normally sits, deciding which 'main' to use, and then jump into the correct target code.
The first is more efficient, since a lot of the 'library' code will be common to the two programs. The second is less work, provided there is enough memory to hold both copies.

Best Wishes
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