Right-click a string constant, control, or indicator and select '\' Codes Display from the shortcut menu to instruct LabVIEW to interpret characters that immediately follow a backslash (\) as a code for non-displayable characters. The backslash mode is useful for debugging VIs and for sending non-displayable characters to instruments, serial ports, and other devices. The following list shows how LabVIEW interprets these codes.
Code | LabVIEW Interpretation |
---|---|
\00 – \FF | Hex value of an 8-bit character; must be uppercase |
\b | Backspace (ASCII BS, equivalent to \08) |
\f | Form feed (ASCII FF, equivalent to \0C) |
\n | Linefeed (ASCII LF, equivalent to \0A)—The Format Into File function automatically converts this code into the platform-dependent end-of-line character. |
\r | Carriage return (ASCII CR, equivalent to \0D) |
\t | Tab (ASCII HT, equivalent to \09) |
\s | Space (equivalent to \20) |
\\ | Backslash (ASCII \, equivalent to \5C) |
Use uppercase letters for hexadecimal characters and lowercase letters for special characters, such as form feed and backspace.
LabVIEW interprets the sequence \BFare as hex BF followed by the word are. It interprets \bFare and \bfare as a backspace followed by the words Fare and fare. In the sequence \Bfare, \B is not the backspace code, and \Bf is not a valid hex code. In a case like this, when a backslash is followed by only part of a valid hex character, LabVIEW assumes a 0 follows the backslash, so LabVIEW interprets \B as hex 0B. Any time a backslash is not followed by a valid hex character, LabVIEW ignores the backslash character.
You can enter some non-displayable characters listed in the previous table from the keyboard, such as a carriage return, into a string control regardless of whether you select '\' Codes Display. However, if you enable the backslash mode when the display window contains text, LabVIEW redraws the display to show the backslash representation of any non-displayable characters and the \ character itself.
Complete the following steps to practice using the '\' Codes Display shortcut menu item.
Indicators behave the same way. Notice that the data in the string does not change from one mode to the other. Only the displayed representation of certain characters changes.