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

Output File Names

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



Joined: 15 Sep 2003
Posts: 226

View user's profile Send private message

Output File Names
PostPosted: Thu Mar 25, 2010 8:09 am     Reply with quote

Sometimes one source can be used for several different mcu.

Is there a way to use a #define statement to output different file names ?

Or is there any way to change the output file names based upon some statement in the source code ?

Thanks
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Mar 25, 2010 11:50 am     Reply with quote

You can use the #export directive to do this. The program shown below
creates the following file:
Quote:

c:\program files\picc\projects\pch_test\myfile.hex

This was tested with vs. 4.106. I don't know if it works in your version.
Code:

#include <18F452.h>
#fuses XT,NOWDT,PUT,BROWNOUT,NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)

#export(HEX, FILE=myfile.hex)
//======================================
void main(void)
{

while(1);
}
Hans Wedemeyer



Joined: 15 Sep 2003
Posts: 226

View user's profile Send private message

Thanks that did the trick !
PostPosted: Fri Mar 26, 2010 10:28 am     Reply with quote

Thanks
MikeW



Joined: 15 Sep 2003
Posts: 184
Location: Warrington UK

View user's profile Send private message

PostPosted: Tue Mar 30, 2010 2:49 am     Reply with quote

I have been playing with PCM programmer's excellent suggestion of #export to have a more meaningful name for the hex file.


I have gotten as far as

#export(HEX, FILE= __date__ __FILENAME__ .hex)

which produces the hex file named

30-Mar-10rad_CPU_CAN_HMI_and_GLCD_Test_11.c

I have encountered 2 issue.

1. since the source code is name xxx.c, presumably windoz truncates to the first dot delimiter, and thus drops the ".hex".

2. cant use __TIME__ since windoz wont write a file with : in the name.

any suggestions ?



Mike
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