Reading Backslash Codes from a File in LabVIEW

Updated Dec 14, 2019

Reported In

Software

  • LabVIEW

Driver

  • NI-VISA

Operating System

  • Windows

Issue Details

I am trying to send commands to my serial device by reading them from a configuration file in LabVIEW where they are written in the form of  '\' codes. But the VISA Write function is processing these inputs as a message or string and not as a valid backslash command. How do I covert these strings to recognizable backslash codes?

Solution

For backslash codes to be recognized as valid commands, you need to replace these strings with the available escape-sequence constants using the Search and Replace String function.

The code below is an example of how the said function can be used to replace backslash codes with valid escape sequences in a given string. 
 

Additional Information

Majority of the backslash codes commonly used are present as escape sequences in the string palette in NI LabVIEW. The details about mapping of backslash codes to escape sequences can be found in the LabVIEW Help .