Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

string problem-double backslash in subVI

When connecting a string constant that include the character "\" to a subVI the backslash character is multiplied.
How can I avoid this?

Additional information, the digital control that is connected is set to "Code display".
0 Kudos
Message 1 of 4
(3,525 Views)

The way to avoid the display problem is to select Normal Display for the string constant. Is this causing any problem other than a visual one? If you want to use the '\' character, it's all the same whether you have Normal, Code, or Hex display. With '\' Code Display turned on, the \\ just means to send the literal '\' character and not some control code.

0 Kudos
Message 2 of 4
(3,521 Views)
The problem is not just a visual.
I am trying to write a command to an instrument followed by "\r\n".
The subVI includes the write to serial port VI.
Within the subVI even before reaching the "Write to.." VI the string includes "\\r\\n" which causes a communication problem with the instrument.
The string that is connected to this subVI end in "...\r\n"
I tried switching to Normal display but the problem becomes hidden but not resolved.
0 Kudos
Message 3 of 4
(3,519 Views)

It sounds like you first had set the control for normal display, entered the \r\n, and then turned on '\' code display. Just delete everything you have in the control and with '\' Code Display on, enter the command plus \r\n. You could also have the command in a string control/constant with normal display turned on and use the concantanate string function with the carriage return and line feed constants on the string palette wired as inputs 2 and 3.

p.s. Next time, post similar messages in either the LabVIEW or serial forum. Posting this type of question in the Digital I/O forum just confuses things.Smiley Wink

Message Edited by Dennis Knutson on 10-10-2006 12:29 PM

0 Kudos
Message 4 of 4
(3,516 Views)