View previous topic :: View next topic |
Author |
Message |
Hans Wedemeyer
Joined: 15 Sep 2003 Posts: 226
|
Output File Names |
Posted: Thu Mar 25, 2010 8:09 am |
|
|
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
|
|
Posted: Thu Mar 25, 2010 11:50 am |
|
|
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
|
Thanks that did the trick ! |
Posted: Fri Mar 26, 2010 10:28 am |
|
|
Thanks |
|
|
MikeW
Joined: 15 Sep 2003 Posts: 184 Location: Warrington UK
|
|
Posted: Tue Mar 30, 2010 2:49 am |
|
|
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 |
|
|
|