TestStand and LabWindows/CVI Enumeration Data Types

Updated May 3, 2018

Reported In

Software

  • TestStand
  • LabWindows/CVI Base

Issue Details

I have an enumeration data type declared in my LabWindows/CVI code that I will be calling from TestStand. I would like to use my enumeration as a parameter in a function I have exported. How can I have TestStand recognize my enumerated values?

Solution


In order for TestStand to recognize your enumerated type, you must create a type library for your DLL. Follow the steps below to create a type library for your function.

  1. Define your enum in a header file (.h).
  2. Create your function in a source code file (.c), and make sure to include the .h header file that you defined the enum in.
  3.  Create a function panel for your function.
    1. Create a .fp file and add it to your workspace.
    2. Create a new function panel window

​​
  1.  Define your enum as a new data type by selecting Options » Data Types, entering the name of your enum, and then adding it to the list. 
    iv. Add inputs and outputs to match your function. When creating the parameter for your enum, make sure to choose the data type you defined.
    v. Save the .fp file.
 
  1. You should now have three files in your workspace which are the header file (.h), source file (.c), and function panel (.fp).
  2. Include the function panel as a type library for you DLL by navigating to Build » Target Settings and clicking the Type Library button. Then enable the Add type library resource to DLL option and browse for your .fp file. Click OK twice to accept the DLL build settings. 
  1. Build the DLL.
  2. Call the DLL in TestStand and observe that TestStand now uses the enumeration symbols in the Value Expression control as shown in the attached "TestStand Parameters.jpg" screenshot.

Additional Information

Inside TestStand, you can specify which LabWindows/CVI DLL to call  by right-clicking your LabWindows/CVI step and selecting Specify Module. Inside of this dialog box select Dynamic Link Library (*.dll). If you select a function that contains a numeric parameter that accepts an enumerated type, the Value Expression control becomes a combo box from which you can select elements of the enumeration. You can either enter an enumeration symbol or its corresponding numeric value directly into the Value Expression control.

The following link contains an example: 

Developer Zone Example: Using Code Module Enumerated Values in TestStand

WAS THIS ARTICLE HELPFUL?

Not Helpful