I had an idea about my program display version information on a 2x16 point LCD. LCD_puts( ) is a function to send caracters of the given string to the LCD. I tried to do it by this way:
LCD_puts( __SDCC );
It gives error at compiling.
LCD_puts( "__SDCC" );
This stores characters between double quotes, not the version number.
#define str( x ) #x
LCD_puts( str( __SDCC ) );
The result is equal what was at the previous.
Finally I tried to put version information as a comment in the assembly code:
__asm ; __SDCC __endasm
and I get what I expected:
So __SDCC constant has the information about the version number of the compiler but I don't know how can I include it into the running code.
Can anybody help me about it?
SDCC : pic14 3.2.1 #8447 (Apr 18 2013) (Linux)
You should use the stringification trick, as explained at http://gcc.gnu.org/onlinedocs/cpp/Stringification.html:
#define xstr(x) str(x)
#define str(x) #x
LCD_puts( xstr( __SDCC ) );
Thanks! That is what I was thinking about.
Log in to post a comment.