10-08-2007 07:27 AM
FileGlobals.Command_connect=Str(0x10,"%c") + Str(0x02,"%c") + Str(0x00,"%c") + Str(0x00,"%c") + Str(0x1D,"%c") + Str(0x0F,"%c") + Str(0x10,"%c") + Str(0x03,"%c")
10-09-2007 07:40 AM
11-23-2009 12:30 PM - edited 11-23-2009 12:34 PM
I too am trying to construct a TestStand string which includes the ascii NUL character - but it is ignored. Anything else is fine.
Str(0x00,"%c") has no effect,
Chr(0x00) has no effect
Is there any way to do this without referring to LabVIEW or a numerical array - but simply doing it in a TestStand expression as a string?
Thanks,
Ronnie
11-23-2009 01:19 PM
TestStand does not support embedded NULLs in strings. Depending on what you are going to be using the string for you can either:
1) Use an array of numbers instead.
2) If you are going to be passing the string into labview you can use an escape sequence to show where you want the NULLs to be, though there won't really be a NULL in the string until the LabVIEW adapter processes it and passes it into labview.
If you are directly calling a dll that takes a string with embedded NULL characters (or really binary data which is not really a string at all) I'd recommend using approach 1) and passing the array of numbers into the function as an array of type 'char'.
Hope this helps,
-Doug
11-23-2009 01:44 PM
Thanks for the quick response Doug.
OK - I'm trying to write out to the serial port using serial.llb\Serial Port Write.vi
Even if I put an escape character in the string ("\0") in the Locals window, and change the Parameter Type to "Binary String" for the LabVIEW call, the RS232 port is still seeing 5C 30 (the ascii equivalents for "\" and "0").
I am looking for the RS232 port to see 00.
11-23-2009 04:53 PM
Believer -
In order to pass a NULL terminating character from TestStand to LabVIEW (with the LabVIEW parameter set to Binary String) you will need to use the string: "\00". If you use "\0", the adapter will assume that you actually wanted to use a "\" and a "0" and will thus actually pass "\\0" to LabVIEW. If you use "\00" the adapter will recognize that you are intentionally sending a NULL terminating character and pass it appropriately. Please give this a try and let me know if it works for you.
Hope this helps.
11-24-2009 10:24 AM