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.
Adding control codes to a string
Moderator: Benj
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
- Contact:
Re: Adding control codes to a string
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.
“Integrity is doing the right thing, even when no one is watching.”
― C.S. Lewis
― C.S. Lewis