[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [avr-gcc-list] Strings: escape sequence to insert arbitrary hexvalue

From: Michael
Subject: RE: [avr-gcc-list] Strings: escape sequence to insert arbitrary hexvalue ?
Date: Fri, 6 Feb 2009 14:03:51 +1100

> Hello, 


> All on-line tutorials on C just do'nt seem to cover all these

> little things I need... these tutorials aren't much help for 

> day to day issues with microcontroller programming I find :-/ 


> Problem: in the strings I define, some of the characters are custom 

> defined (ASCII codes 0 to 7 in a text LCD module). 


> I have some defines like such: 


> #define LCD_CUSTOM_CHAR_FOO <any value from 0 to 7 and 0x80 and up> 


> char example[] = "Example String"; 


> Now I need to insert the define "LCD_CUSTOM_CHAR_FOO" somewhere in 

> the string, and have the compiler replace it with the hex code it 

> stands for... how to instruct the compiler to do so ?! 


> TIA 



> Regards, 



> -- 

> Vince, the devil is in the detail they say... 

I'm not sure if this may be of any use to you, but I find it pretty
handy when I need to send special characters. 

If you have a #define: 

#define PDATA(type, ...) (__extension__({static type __nonamed[] PROGMEM
= __VA_ARGS__ ; &__nonamed[0];})) 

You can specify any data you like in program memory, like PSTR() only
with data. 



I'd like to see this included in <avr/pgmspace.h> 




AVR-GCC-list mailing list 




I am using the Free version of SPAMfighter
We are a community of 5.9 million users fighting spam.
SPAMfighter has removed 386 of my spam emails to date.
The Professional version does not have this message

reply via email to

[Prev in Thread] Current Thread [Next in Thread]