Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
This Document is not yet Rated

How Can I Pass a Binary String from TestStand to a Code Module?



Primary Software: TestStand
Primary Software Version: 2010 SP1
Primary Software Fixed Version: N/A
Secondary Software: Utility Software>>NI System Configuration API

Problem:
I am working with strings that represent binary data in my sequence, and I would like to pass these strings to and from my code modules.  What is the proper way to accomplish this to ensure that data is not lost?

Solution:
The appropriate method of passing binary strings differs based on the code module type:

DLLs (CVI and DLL adapters)

Use a Numeric Array, where each element of the array represents the ASCII code of a character in the string. When specifying the parameter in TestStand, use an Array of Numerics and specify data type as 8-bit signed integer. Use char * in the function prototype for the parameter in the DLL.

LabVIEW
Enable the Binary String setting for the parameter. Use the special encoding of "\00" for NULL characters in your binary string to ensure they are not lost.

Note:
A known issue exists with this setting when using the Binary String option with the LabVIEW Run-Time engine in TestStand 2010 and previous.  Refer to issue 310030 in the TestStand 2010 Known issues List for more information.

.NET
Use the byte array type in C# and use a Numeric Array in TestStand. You can convert a byte array to a .NET string in .NET using the Encoding class (e.g. Encoding.ASCII.GetString(byteArray)).

Note: if a .NET string contains embedded null characters, TestStand truncates the string at the first null character


Related Links:
Incorrect Value when Passing LabVIEW Binary String Control Defaults from TestStand
TestStand 2010 Known issues List

Attachments:





Report Date: 04/16/2012
Last Updated: 09/28/2012
Document ID: 5WFDM4E3

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit