02-25-2021 03:48 AM
Hello,
I get a binary string from Serial Port Read.vi:
"\00\A5"
TestStand String Value Test cut it after "\0
Is there a way to escape it?
The same Problem was here disscussed:
https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019S80SAE&l=de-CH
I also found:
https://zone.ni.com/reference/en-XX/help/370052AA-01/tsapiref/reftopics/utility_escape_m/
Can anyone give my an adwise how to solve it ?
Attached my simple Test
Greets Martin
Solved! Go to Solution.
02-25-2021 07:00 AM
Your main issue is that strings in TestStand cannot have a NULL character. I'm assuming this is coming from the C definition of strings (must be terminated with a NULL character). Instead, you could use an array of bytes (String to Byte Array in your VI) and have your limit also be an array of bytes. Another option would be to have your VI pass out the data converted to an ASCII format (ex: pass out "00A5" instead of "\00\A5").
02-25-2021 01:43 PM
Hi,
Did you try to change the type for the string parameter to binary?
Regards,
Anand Jain
NI
02-25-2021 05:14 PM
Also, if you ever need to programmatically store a string with an embedded null in a TestStand variable or property, there is this: SetValBinary Method - TestStand 2019 Help - National Instruments (ni.com)
03-01-2021 02:43 AM
@Anand Jain
Thanks for your help.
Yes I have allredy set the type to binary.
Generely it works this way.
but...
If I set to binary, I get a String something like "E@=3@J20100hULSH0:00RW0V"
Not nice...
I would prefer to get something like "\00\A5"
Greets
03-01-2021 02:57 AM
@crossrulz
Thanks for your help.
Instead, you could use an array of bytes (String to Byte Array in your VI) and have your limit also be an array of bytes
Ok. But if I do it this was, i cannot use a String Value Test.
Correct?
Another option would be to have your VI pass out the data converted to an ASCII format (ex: pass out "00A5" instead of "\00\A5")
Ok. If I do it in this way, is there allredy a LabView function to do this?
What function can I use afterwards the output "string read"?
Greets