Page 1 of 1

Adding control codes to a string

Posted: Wed Aug 01, 2018 1:15 am
by crispin12
I've inserted a UART component macro into my program that is Send String. In the macro properties window I have the Name - Data, Type <- STRING, and Expression "This is a string"
How do you add the control codes for end of string and line feed?
In the expression box do I type "This is a string \0\r\n"
I thought the control codes had to be outside the "...." but when trying to add them outside the " " I receive an invalid expression when I attempt to save and close the component macro.

Re: Adding control codes to a string

Posted: Wed Aug 01, 2018 2:02 am
by kersing
Control codes like \n and \r need to be inside the quotes. Adding \0 will terminate the string at that point, any characters beyond will be ignored, so avoid adding it before other control characters.