Purpose

This example demonstrates how to use the TestStand API from a LabWindows/CVI DLL code module to access a one-dimensional array, two-dimensional array, and an array of strings in TestStand.

Example File Location

<TestStand Public>\Examples\TestStand API\Accessing Arrays Using API\CVI\Accessing Arrays Using API.seq

Highlighted Features

  • LabWindows/CVI Adapter
  • TestStand API

Major API

  • PropertyObject.NewSubProperty
  • PropertyObject.GetValVariant
  • PropertyObject.SetValVariant

Prerequisites

You must have the LabWindows/CVI Run-Time Engine installed and you must configure the LabWindows/CVI Adapter to execute steps in-process. If you want to use the Execute Steps in an External Instance of CVI option, you must have the LabWindows/CVI development environment installed.

How to Use This Example

Open the AccessArrays.c source file, located in the <TestStand Public>\Examples\TestStand API\Accessing Arrays Using API\CVI directory, and review the following defined functions and the TestStand API calls used to get and set the TestStand local variables:

  • FillLocalArray—Demonstrates how to use the TestStand API from LabWindows/CVI to populate an array stored in a TestStand local variable.
  • AccessLocalArray—Demonstrates how to use the TestStand API from LabWindows/CVI to read an array stored in a TestStand local variable and display a graph of the data.
  • Create2DArray—Demonstrates how to use the TestStand API from LabWindows/CVI to dynamically create and populate a two-dimensional array stored in a TestStand local variable
    Note Normally, this function would use the InsertIfMissing property option to create the local variable, but this example does not use this property option to maintain compatibility with previous versions of TestStand.
  • Access2DArray—Demonstrates how to use the TestStand API from LabWindows/CVI to read a two-dimensional array stored in a TestStand local variable and display a graph of the data.
  • SetStringArray—Demonstrates how to use the TestStand API from LabWindows/CVI to populate a string array stored in a TestStand local variable.
  • GetStringArray—Demonstrates how to use the TestStand API from LabWindows/CVI to read a string array stored in a TestStand local variable and display the strings in a message popup.

Complete the following steps to review how TestStand calls the functions in the DLL, review the created local variables, and review the parameters passed to and from the functions.

  1. Open the AccessingArrays.seq example sequence file. On the Variables pane, the NumericArray and StringArray local variables have been created, but do not contain any data.
  2. On the Steps pane, select an Action step.
  3. On the Step Settings pane, review the settings for the Action step. The step does not pass local variables to or return local variables from the function.
  4. Select Execute»Single Pass to run the sequence. The DLL calls populate the local variables with data, and LabWindows/CVI accesses and displays the data.