How Does the '\' Codes String Display Mode Work?

Updated Dec 10, 2017

Reported In

Software

  • LabVIEW Full

Issue Details

When I right click on a string control or indicator on my LabVIEW front panel, I see the option to change to a '\' Codes Display. What exactly does this do?

Solution

The '\' Codes Display, often called "slash codes display", allows you to see a string as it is actually represented in memory as opposed to how it is displayed on your front panel. 

For example, the slash code for a space character is \s. If you type Hello World! into a string control with a normal display and then change the string control into a slash codes display, you will see Hello\sWorld!. The space character was replaced by its slash code equivalent. If a character in a string does not have a common escape character (i.e. \s for space and \t for tab), it will be represented by a slash followed by the ASCII value of that character in hex. For example, if you have an ESC character in your string, it would be represented as \1B which is the ASCII value for ESC. 
 

Additional Information

The slash codes display is especially useful when you are using serial communication and the termination characters are important. For example, a common command to be sent to a serial instrument is *IDN?\r\n where the \r\n represent a carriage return and a line feed, respectively. In a string control in normal display mode, this string looks like *IDN? because the \r and the \nare not displayable characters. To make sure you are terminating your commands correctly, go to the slash codes display and make sure the appropriate termination characters are visible.

WAS THIS ARTICLE HELPFUL?

Not Helpful