Using Labview and CVI With Teststand
Using Labview and CVI With Teststand
TM
May 2009
375070A-01
Support
Worldwide Offices
Australia 1800 300 800, Austria 43 662 457990-0, Belgium 32 (0) 2 757 0020, Brazil 55 11 3262 3599,
Canada 800 433 3488, China 86 21 5050 9800, Czech Republic 420 224 235 774, Denmark 45 45 76 26 00,
Finland 358 (0) 9 725 72511, France 01 57 66 24 24, Germany 49 89 7413130, India 91 80 41190000,
Israel 972 3 6393737, Italy 39 02 41309277, Japan 0120-527196, Korea 82 02 3451 3400,
Lebanon 961 (0) 1 33 28 28, Malaysia 1800 887710, Mexico 01 800 010 0793, Netherlands 31 (0) 348 433 466,
New Zealand 0800 553 322, Norway 47 (0) 66 90 76 60, Poland 48 22 328 90 10, Portugal 351 210 311 210,
Russia 7 495 783 6851, Singapore 1800 226 5886, Slovenia 386 3 425 42 00, South Africa 27 0 11 805 8197,
Spain 34 91 640 0085, Sweden 46 (0) 8 587 895 00, Switzerland 41 56 2005151, Taiwan 886 02 2377 2222,
Thailand 662 278 6777, Turkey 90 212 279 3031, United Kingdom 44 (0) 1635 523545
For further support information, refer to the Technical Support and Professional Services appendix. To comment
on National Instruments documentation, refer to the National Instruments Web site at ni.com/info and enter
the info code feedback.
Copyright
Under the copyright laws, this publication may not be reproduced or transmitted in any form, electronic or mechanical, including photocopying,
recording, storing in an information retrieval system, or translating, in whole or in part, without the prior written consent of National
Instruments Corporation.
National Instruments respects the intellectual property of others, and we ask our users to do the same. NI software is protected by copyright and other
intellectual property laws. Where NI software may be used to reproduce software or other materials belonging to others, you may use NI software only
to reproduce materials that you may reproduce in accordance with the terms of any applicable license or other legal restriction.
Trademarks
National Instruments, NI, ni.com, NI TestStand, and LabVIEW are trademarks of National Instruments Corporation. Refer to the Terms of Use
section on ni.com/legal for more information about National Instruments trademarks.
Other product and company names mentioned herein are trademarks or trade names of their respective companies.
Members of the National Instruments Alliance Partner Program are business entities independent from National Instruments and have no agency,
partnership, or joint-venture relationship with National Instruments.
Patents
For patents covering National Instruments products/technology, refer to the appropriate location: Help»Patents in your software,
the patents.txt file on your media, or the National Instruments Patent Notice at ni.com/patents.
» The » symbol leads you through nested menu items and dialog box options
to a final action. The sequence File»Page Setup»Options directs you to
pull down the File menu, select the Page Setup item, and select Options
from the last dialog box.
bold Bold text denotes items that you must select or click in the software, such
as menu items and dialog box options. Bold text also denotes parameter
names.
monospace Text in this font denotes text or characters that you should enter from the
keyboard, sections of code, programming examples, and syntax examples.
This font is also used for the proper names of disk drives, paths, directories,
programs, subprograms, subroutines, device names, functions, operations,
variables, filenames, and extensions.
monospace italic Italic text in this font denotes text that is a placeholder for a word or value
that you must supply.
Platform Text in this font denotes a specific platform and indicates that the text
following it applies only to that platform.
Contents
Chapter 1
Role of LabVIEW and LabWindows/CVI in a TestStand-Based System
Code Modules ................................................................................................................1-1
Custom User Interfaces..................................................................................................1-2
Custom Step Types ........................................................................................................1-2
LabVIEW Adapter .........................................................................................................1-2
LabWindows/CVI Adapter ............................................................................................1-3
PART I
Using LabVIEW with TestStand
Chapter 2
Calling LabVIEW VIs from TestStand
Required LabVIEW Settings .........................................................................................2-1
LabVIEW Module Tab ..................................................................................................2-2
Creating and Configuring a New Step Using the LabVIEW Adapter ...........................2-3
Chapter 3
Creating, Editing, and Debugging LabVIEW VIs from TestStand
Creating a New VI from TestStand ...............................................................................3-1
Editing an Existing VI from TestStand..........................................................................3-2
Debugging a VI..............................................................................................................3-3
Chapter 4
Using LabVIEW Data Types with TestStand
Calling VIs with String Parameters ...............................................................................4-4
Calling VIs with Cluster Parameters .............................................................................4-4
Specifying Each Cluster Element Individually ...............................................4-5
Passing Existing TestStand Container Variables to LabVIEW.......................4-5
Creating a New Custom Data Type.................................................................4-6
Creating TestStand Data Types from LabVIEW Clusters.............................................4-8
Chapter 5
Configuring the LabVIEW Adapter
Selecting a LabVIEW Server ........................................................................................ 5-1
Using a LabVIEW Run-Time Engine or Other Executable Server ................ 5-2
Using a LabVIEW 8.6.x or Later Development System................................. 5-4
Per-Step Configuration of the LabVIEW Adapter.......................................... 5-4
Reserving Loaded VIs for Execution ............................................................................ 5-4
Code Template Policy ................................................................................................... 5-5
Legacy VI Settings ........................................................................................................ 5-7
Chapter 6
Creating Custom User Interfaces in LabVIEW
TestStand User Interface Controls................................................................................. 6-1
TestStand VIs and Functions......................................................................................... 6-1
Creating Custom User Interfaces................................................................................... 6-2
Configuring the TestStand UI Controls .......................................................... 6-3
Enabling Sequence Editing ............................................................................. 6-4
Handling Events .............................................................................................. 6-4
Starting and Shutting Down TestStand ........................................................... 6-6
Menu Bars and Menu Event Handling............................................................ 6-7
Localization..................................................................................................... 6-8
Other User Interface Utilities ........................................................................................ 6-8
Making Dialog Boxes Modal to TestStand..................................................... 6-8
Checking for Suspended or Stopped Executions within Code Modules ........ 6-9
Running User Interfaces ................................................................................................ 6-9
Chapter 7
Using LabVIEW 8.x with TestStand
Using LabVIEW 8.0...................................................................................................... 7-1
LabVIEW 8.0 Real-Time Module Incompatibility......................................... 7-1
Projects............................................................................................................ 7-1
Project Libraries .............................................................................................. 7-2
Network-Published Shared Variables ............................................................. 7-2
Deploying Variables ......................................................................... 7-2
Using an Aliases File ........................................................................ 7-3
NI-DAQmx Tasks, Channels, and Scales in LabVIEW Projects ................... 7-3
Conditional Disable Structures and Symbols.................................................. 7-4
64-Bit Integer Data Type ................................................................................ 7-4
XControls ........................................................................................................ 7-4
Remote Execution ........................................................................................... 7-4
Building a TestStand Deployment with LabVIEW 8.0 .................................. 7-5
LabVIEW Object-Oriented Programming .................................................................... 7-7
Chapter 8
Calling LabVIEW VIs on Remote Computers
Configuring a Step to Run Remotely.............................................................................8-1
Configuring the LabVIEW VI Server to Run VIs Remotely.........................................8-2
Configuring a LabVIEW RT Server to Run VIs ...........................................................8-3
User Access to VI Server...............................................................................................8-4
Chapter 9
Using the TestStand ActiveX APIs in LabVIEW
Invoking Methods ..........................................................................................................9-1
Accessing Built-In Properties ........................................................................................9-1
Accessing Dynamic Properties ......................................................................................9-2
Releasing ActiveX References ......................................................................................9-3
Using TestStand API Constants and Enumerations.......................................................9-4
Obtaining a Different Interface for TestStand Objects ..................................................9-5
Acquiring a Derived Class from the PropertyObject Class ...........................................9-5
Duplicating COM References in LabVIEW Code Modules .........................................9-6
Setting the Preferred Execution System for LabVIEW VIs ..........................................9-7
Handling Events.............................................................................................................9-8
Chapter 10
Calling Legacy LabVIEW VIs
Format of Legacy VIs ....................................................................................................10-1
Test Data Cluster .............................................................................................10-2
Error Out Cluster .............................................................................................10-3
Input Buffer String Control .............................................................................10-4
Invocation Info Cluster....................................................................................10-4
Sequence Context Control...............................................................................10-5
PART II
Using LabWindows/CVI with TestStand
Chapter 11
Calling LabWindows/CVI Code Modules from TestStand
Required LabWindows/CVI Settings ............................................................................11-1
LabWindows/CVI Module Tab .....................................................................................11-1
Source Code Buttons .......................................................................................11-3
Creating and Configuring a New Step Using the LabWindows/CVI Adapter ..............11-4
© National Instruments Corporation vii Using LabVIEW and LabWindows/CVI with TestStand
Contents
Chapter 12
Creating, Editing, and Debugging LabWindows/CVI Code Modules
from TestStand
Creating a New Code Module from TestStand ............................................................. 12-1
Editing an Existing Code Module from TestStand........................................................ 12-3
Debugging a Code Module............................................................................................ 12-3
Chapter 13
Using LabWindows/CVI Data Types with TestStand
Calling Code Modules with String Parameters ............................................................. 13-2
Calling Code Modules with Object Parameters ............................................................ 13-3
Calling Code Modules with Struct Parameters ............................................................. 13-3
Creating TestStand Data Types from LabWindows/CVI Structs.................................. 13-4
Creating a New Custom Data Type ................................................................ 13-4
Specifying Structure Passing Settings............................................................. 13-5
Calling a Function With a Struct Parameter ................................................... 13-5
Chapter 14
Configuring the LabWindows/CVI Adapter
Showing Function Arguments in Step Descriptions ..................................................... 14-2
Setting the Default Structure Packing Size ................................................................... 14-2
Selecting Where Steps Execute ..................................................................................... 14-2
Executing Code Modules in an External Instance of LabWindows/CVI ....... 14-2
Debugging Code Modules ................................................................ 14-3
Executing Code Modules In-Process .............................................................. 14-3
Object and Library Code Modules ................................................... 14-3
Source Code Modules....................................................................... 14-5
Debugging DLL Code Modules ....................................................... 14-5
Loading Subordinate DLLs............................................................................. 14-5
Per-Step Configuration of the LabWindows/CVI Adapter............................. 14-6
Code Template Policy ................................................................................................... 14-7
Chapter 15
Creating Custom User Interfaces in LabWindows/CVI
TestStand User Interface Controls................................................................................. 15-1
Creating and Configuring ActiveX Controls .................................................. 15-1
Programming with ActiveX Controls ............................................................. 15-1
Creating Custom User Interfaces................................................................................... 15-3
Configuring the TestStand UI Controls .......................................................... 15-4
Enabling Sequence Editing ............................................................................. 15-4
Chapter 16
Using the TestStand ActiveX APIs in LabWindows/CVI
Using ActiveX Drivers in LabWindows/CVI................................................................16-1
Invoking Methods ..........................................................................................................16-2
Accessing Built-In Properties ........................................................................................16-3
Accessing Dynamic Properties ......................................................................................16-4
Adding and Releasing References .................................................................................16-5
Using TestStand API Constants and Enumerations.......................................................16-7
Handling Events.............................................................................................................16-8
Chapter 17
Adding Type Libraries To LabWindows/CVI DLLs
Generating Type Library Information ...........................................................................17-1
Chapter 18
Calling Legacy LabWindows/CVI Code Modules
Prototypes of Legacy Code Modules.............................................................................18-1
tTestData Structure..........................................................................................18-2
tTestError Structure .........................................................................................18-3
Updating Step Properties.................................................................................18-4
Example Code Module ..................................................................................................18-5
Appendix A
Technical Support and Professional Services
Index
Code Modules
TestStand can call LabVIEW virtual instruments (VIs) with a variety of
connector pane configurations. TestStand can call VIs that reside on the
same computer as TestStand or on other network computers, including
computers running the LabVIEW Real-Time (RT) module. TestStand can
call LabWindows/CVI code modules with a variety of function prototypes.
TestStand can also pass data to the VIs and code modules it calls and store
the data the VI or code module returns. Additionally, the VIs and code
modules TestStand calls can access the complete TestStand application
programming interface (API) for advanced applications.
© National Instruments Corporation 1-1 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 1 Role of LabVIEW and LabWindows/CVI in a TestStand-Based System
LabVIEW Adapter
The LabVIEW Adapter offers advanced functionality for calling VIs from
TestStand. You can use the LabVIEW Adapter to perform the following
tasks:
• Call VIs with arbitrary connector panes
• Call VIs on remote computers
• Run VIs in the LabVIEW Run-Time Engine
• Call VIs from versions of TestStand earlier than 3.0 and LabVIEW
Test Executive VIs
• Create and edit VIs from TestStand
• Debug VIs (step in/step out) from TestStand
• Run VIs using the LabVIEW development system or a LabVIEW
executable
Refer to the Using LabVIEW with TestStand part of this manual for
information about using LabVIEW with TestStand.
LabWindows/CVI Adapter
The LabWindows/CVI Adapter offers advanced functionality for
calling code modules from TestStand. You can use the LabWindows/CVI
Adapter to perform the following tasks:
• Call code modules with arbitrary function prototypes
• Create and edit code modules from TestStand
• Debug code modules (step in/step out) from TestStand
• Run code modules in-process or out-of-process using the
LabWindows/CVI development system
Refer to the Using LabWindows/CVI with TestStand part of this manual for
information about using LabWindows/CVI with TestStand.
© National Instruments Corporation 1-3 Using LabVIEW and LabWindows/CVI with TestStand
Part I
© National Instruments Corporation I-1 Using LabVIEW and LabWindows/CVI with TestStand
Part I Using LabVIEW with TestStand
© National Instruments Corporation 2-1 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 2 Calling LabVIEW VIs from TestStand
2 3 4
1 5
Use the LabVIEW Module tab in the TestStand Sequence Editor to specify
the VI the step executes and to specify if LabVIEW shows the front panel
of the VI when TestStand calls the VI. The Module tab includes
Source Code buttons for selecting an Express VI and converting an Express
VI to a standard VI.
The LabVIEW Module tab also contains the following specific information
about the VI to call:
• VI Parameter Table—Contains the following information about each
control and indicator, also called the parameters of the VI, wired to the
connector pane of the VI:
– Parameter Name—The caption text for the control or indicator.
When no caption exists, this field contains the label text.
– Type—The LabVIEW data type for the control or indicator. Refer
to Chapter 4, Using LabVIEW Data Types with TestStand, for
more information about how LabVIEW data types map to
TestStand data types.
Note Parameters are listed in the VI Parameter Table according to their order in the VI
context help image.
Click the Help or Help Topic button on the Help toolbar to access
the NI TestStand Help, which provides additional information about the
LabVIEW Module tab.
© National Instruments Corporation 2-3 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 2 Calling LabVIEW VIs from TestStand
Note All expression fields support typeahead and autocomplete with drop-down lists and
context-sensitive highlighting. At any point while editing an expression, you can press
<Ctrl-Space> to show a drop-down list of valid expression elements.
When TestStand calls the VI, it places the value the VI returns
in the PASS/FAIL Flag and Report Text indicators into the
Result.PassFail and Result.ReportText properties of the step,
respectively.
7. Notice that TestStand automatically fills in the Value column of the
error out output parameter with the Step.Result.Error property.
Note By default, when a VI uses the standard LabVIEW error out cluster as an output
parameter, TestStand automatically passes that value into the Step.Result.Error
property for the step. You can also update the value manually.
Note The TestStand Numeric Limit Test step type requires code modules to store a
measurement value in the Step.Result.Numeric property, and the step type performs a
comparison operation to determine whether the step passes or fails. Code modules can
update step properties by passing step properties as parameters to and from the module or
by using the TestStand API in the module. When you use a default code template from
National Instruments to create a module, TestStand creates the parameters needed to access
the step properties for you.
© National Instruments Corporation 3-1 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 3 Creating, Editing, and Debugging LabVIEW VIs from TestStand
Refer to the Code Templates Tab section of Chapter 13, Custom Step
Types, of the NI TestStand Reference Manual for more information about
creating code templates for step types.
Debugging a VI
Complete the following steps to debug a VI you call from TestStand using
the LabVIEW Adapter.
1. Open <TestStand Public>\Tutorial\Call LabVIEW VI.seq.
2. Place a breakpoint on the LabVIEW Pass/Fail Test step.
3. Save the sequence file and select Execute»Run MainSequence to
start an execution of MainSequence.
4. When the execution pauses, click the Step Into button on the sequence
editor toolbar. LabVIEW becomes the active application, in which the
LabVIEW Pass-Fail Test VI is open and in a suspended state.
5. Open the block diagram of the suspended VI.
6. Click the Step Into button or the Step Over button on the LabVIEW
toolbar to begin single-stepping through the VI. You can click the
Continue button at any time to finish single-stepping through the VI.
7. When you finish single-stepping through the VI, click the Return to
Caller button on the LabVIEW toolbar to return to TestStand. The
execution pauses at the next step in the sequence.
8. Select Debug»Resume or click the Resume button on the Debug
toolbar in TestStand to complete the execution.
9. Close the Execution window.
You can run the VI multiple times before returning to TestStand. However,
LabVIEW passes the results only from the last run to TestStand when you
finish debugging.
© National Instruments Corporation 3-3 Using LabVIEW and LabWindows/CVI with TestStand
Using LabVIEW Data Types
4
with TestStand
TestStand provides number, string, Boolean, and object reference built-in
data types. TestStand also provides several standard named data types,
including Path, Error, LabVIEWAnalogWaveform, and others. You can
create container data types to hold any number of other data types.
TestStand container data types are analogous to LabVIEW clusters.
You can use references to external objects, such as ActiveX (Microsoft
ActiveX) objects or VISA sessions, between different types of code
modules.
© National Instruments Corporation 4-1 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 4 Using LabVIEW Data Types with TestStand
© National Instruments Corporation 4-3 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 4 Using LabVIEW Data Types with TestStand
For string parameters, use the ring control in the Type column of the
VI Parameter Table on the LabVIEW Module tab to select ASCII String
or Binary String. The default value is ASCII String. TestStand does not
modify the values of ASCII strings it passes to or from VIs.
Select Binary String in the Type column to store a LabVIEW string that
contains binary data in a TestStand property. TestStand escapes the string
before storing it and substitutes hexadecimal codes for the unprintable
characters, such as the NUL character, in the string.
To pass a string escaped to a VI, select Binary String in the Type column.
TestStand unescapes the string before passing it to the VI and substitutes
the correct character values for the hexadecimal values in the escaped
string.
You can create a custom data type that matches a LabVIEW cluster. For
input parameters, you can pass the default value for the entire cluster or the
default values for specific elements of the cluster control on the front panel
of the VI.
For output parameters, you can optionally specify where TestStand stores
the cluster value or specific elements of the cluster value.
When you use several VIs with a complex array of clusters that is not
used in TestStand, you can use the LabVIEWClusterArray data type,
which adapts to the array of clusters as needed. First, use the
LabVIEWClusterArray data type as an output expression that TestStand
uses to adapt the data type to fit the array of clusters. Then, you can pass
the data type to the remaining VIs as an input.
Use the LabVIEW Cluster Passing tab of the Type Properties dialog box for
the new custom data type to specify how TestStand maps subproperties to
elements in a LabVIEW cluster. Then, when you specify the data to pass
for a cluster parameter, use a variable that is an instance of the new custom
data type. Refer to the NI TestStand Help for more information about the
Type Properties dialog box.
© National Instruments Corporation 4-5 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 4 Using LabVIEW Data Types with TestStand
Figure 4-2 shows how the data passed to the Input Cluster parameter is a
local variable called ContainerData with a type of InputData. Figure 4-3
shows the custom InputData data type.
Figure 4-4. Create Custom Data Type From Cluster Dialog Box
• Type Name—Specify the name of the TestStand custom data type you
want to create.
• Property Type—Specify the TestStand data type to use for cluster
elements that are variants.
• Property Name—Specify the names of the subproperties that map to
the elements of the cluster.
• Create Custom Data Type In File—Specify where TestStand creates
the type.
When you update a strict type definition in LabVIEW, you must also update
all instances of the custom data type you created in TestStand from that
LabVIEW strict type definition. TestStand does not automatically update
custom data types with changes you make in LabVIEW.
© National Instruments Corporation 4-7 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 4 Using LabVIEW Data Types with TestStand
© National Instruments Corporation 4-9 Using LabVIEW and LabWindows/CVI with TestStand
Configuring the LabVIEW
5
Adapter
Configure the LabVIEW Adapter to select a LabVIEW server, reserve
loaded VIs for execution, establish a code template policy, and change
legacy VI settings.
© National Instruments Corporation 5-1 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 5 Configuring the LabVIEW Adapter
Note (Windows Vista) Windows Vista requires you to log in as a user with administrator
privileges to register a server. LabVIEW cannot register ActiveX servers on Windows
Vista when building executables without elevation. When you use TestStandLVRTS.exe
with Windows Vista to run VIs and you receive an error because the server is not registered,
run TestStandLVRTS.exe as an administrator to register the server.
Normally, the LabVIEW RTE can execute top-level VIs only when you
save the VI with the entire VI hierarchy or when the LabVIEW RTE can
locate the subVIs using the LabVIEW search directories. By default, the
LabVIEW RTE does not search for required subVIs within the LabVIEW
development system, such as files in vi.lib. However, when TestStand
loads a LabVIEW RTE on a computer where you also installed the
LabVIEW development system, TestStand automatically adds directories
from the development system to the search paths for the LabVIEW RTE.
Therefore, when TestStand executes a top-level VI saved without its
hierarchy, the LabVIEW RTE attempts to find subVIs by first searching the
directory of the top-level VI and then searching the directories TestStand
added. When the LabVIEW RTE finds a subVI saved by a different version
of LabVIEW first, the LabVIEW RTE cannot load the subVI and does not
load the top-level VI.
© National Instruments Corporation 5-3 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 5 Configuring the LabVIEW Adapter
Although reserving VIs with this option reduces the amount of time
required for TestStand to call the VIs, it also blocks other applications from
using any VIs TestStand loads, including subVIs of the VIs TestStand calls
directly.
When you open a reserved VI in LabVIEW, the Run arrow, shown at left,
indicates the VI is reserved, and you cannot edit the VI. To edit a VI
TestStand has reserved, click the Edit Code button, shown at left, on the
LabVIEW Module tab or right-click the step and select Edit Code from the
context menu to open the VI in TestStand. You can also select File»Unload
All Modules in the sequence editor before you open the VI in LabVIEW.
You must close any references you create to VIs. When TestStand loads and
reserves VIs, LabVIEW does not automatically close the references until
TestStand unloads the VIs that created the references. Failing to close the
references could result in a memory leak in the test system.
When you enable the Allow New and Legacy Templates option and create
a new VI using the LabVIEW Module tab, TestStand launches the Choose
Code Template dialog box, in which you can select the template to use.
Enable the Show Legacy Templates in List option to show the legacy
templates. When you select a legacy template, you enable the Optional
Parameters for Legacy Templates section in the Choose Code Template
dialog box, in which you can select the optional parameters you want to
include as input parameters for the VI, as shown in Figure 5-2.
© National Instruments Corporation 5-5 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 5 Configuring the LabVIEW Adapter
When you enable the Allow Only Legacy Templates option and create a
new VI using the LabVIEW Module tab, TestStand launches the Optional
Parameters dialog box, in which you select the optional parameters, such as
Input Buffer, Invocation Info, or Sequence Context ActiveX Pointer,
you want to include as input parameters for the VI.
When you enable the Allow Only New Templates option and create a new
VI using the LabVIEW Module tab, TestStand creates a new VI based on
the code template for the specified step type. When the step type has
multiple code templates available, TestStand launches the Choose Code
Template dialog box, as shown in Figure 5-2, in which you can select the
code template to use for the new VI.
Refer to the NI TestStand Help for more information about the Choose
Code Template dialog box.
Legacy VI Settings
Click the Legacy VI Settings button in the LabVIEW Adapter
Configuration dialog box to launch the Legacy VI Settings dialog box, in
which you can configure settings relevant to calling legacy test VIs. The
Legacy VI Settings dialog box contains expressions the LabVIEW Adapter
evaluates to generate values to pass to the VI in the various Invocation Info
cluster fields. Legacy VIs can use the Invocation Info cluster as an
optional input. Refer to the Invocation Info Cluster section of Chapter 10,
Calling Legacy LabVIEW VIs, for more information about the Invocation
Info cluster.
© National Instruments Corporation 5-7 Using LabVIEW and LabWindows/CVI with TestStand
Creating Custom User Interfaces
6
in LabVIEW
You can create custom user interfaces and create user interfaces for other
components, such as custom step types. Refer to Chapter 9, Creating
Custom User Interfaces, of the NI TestStand Reference Manual for more
information about the TestStand User Interface (UI) Controls.
When you place the TestStand UI Controls on the front panel of a VI, you
can use the LabVIEW ActiveX functionality to program the controls. You
can also configure the controls interactively using the LabVIEW Property
Browser or control property pages if available. Right-click the control and
select Property Browser from the context menu to open the LabVIEW
Property Browser. Right-click the control and select Properties from the
context menu to open the property page.
Use the TestStand VIs and functions for the following tasks:
• Inserting menu items that automatically execute commands the
TestStand UI Controls provide
• Localizing the strings in a user interface
• Making dialog boxes VIs launch modal to TestStand applications
© National Instruments Corporation 6-1 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 6 Creating Custom User Interfaces in LabVIEW
User interfaces can also include a menu bar that contains non-TestStand
items and items that invoke TestStand commands.
Refer to the example user interfaces included with TestStand for more
information about creating a user interface using the TestStand UI Controls
in LabVIEW. Begin with the simple user interface example, <TestStand
Public>\UserInterfaces\Simple\LabVIEW\TestExec.llb\
Simple OI - Top-Level VI.vi. Refer to the full-featured example,
<TestStand Public>\UserInterfaces\Full-Featured\
LabVIEW\TestExec.llb\Full UI - Top-Level VI.vi, for a more
advanced sequence editor example that includes menus and localization
options.
TestStand installs the source code files for the default user interfaces
in the <TestStand Public>\UserInterfaces and
<TestStand>\UserInterfaces directories. To modify the installed
user interfaces or to create new user interfaces, modify the files in the
<TestStand Public>\UserInterfaces directory. You can use
the read-only source files for the default user interfaces in the
<TestStand>\UserInterfaces directory as a reference. When you
modify installed files, rename the files after you modify them if you want
to create a separate custom component. You do not have to rename the files
after you modify them if you only want to modify the behavior of an
existing component. If you do not rename the files and you use the files in
a future version of TestStand, changes National Instruments makes to the
component might not be compatible with the modified version of the
component. Storing new and customized files in the <TestStand
Public> directory ensures that new installations of the same version of
TestStand do not overwrite the customizations and ensures that uninstalling
TestStand does not remove the files you customize.
Note When you place a TestStand UI Control on the front panel of a VI, you must set the
Preferred Execution System to user interface for the VI. In addition, National Instruments
recommends that when a TestStand User Interface performs ActiveX operations that can
process messages or performs TestStand operations that can call back into LabVIEW, the
application must perform these operations in a LabVIEW execution system other than user
interface, such as standard or other 2. Performing these operations in the user interface
execution system can result in hang conditions.
© National Instruments Corporation 6-3 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 6 Creating Custom User Interfaces in LabVIEW
Handling Events
TestStand UI Controls generate events to notify the application of user
input and application events, such as the completion of an execution.
To handle an event in LabVIEW, you register a callback VI, which
LabVIEW automatically calls when the control generates the event.
Complete the following steps to use the Register Event Callback function,
available in the LabVIEW Full or Professional Development System.
1. Wire the reference of the control that sends the event you want to
handle to the Event input of the Register Event Callback function.
2. Use the Event input terminal drop-down list to select the specific event
you want to handle.
3. When you want to pass custom data to the callback VI, wire the custom
data to the User Parameter input of the Register Event Callback
function. The User Parameter input can be any data type.
4. Right-click the VI Ref input of the Register Event Callback function
and select Create Callback VI from the context menu. LabVIEW
creates an empty callback VI with the correct input parameters for the
particular event, including an input parameter for any custom data you
wired to the User Parameter input in step 3.
5. Save the new callback VI. The block diagram that contains the
Register Event Callback function now shows a Static VI Reference
node wired to the VI Ref input of the function. This node returns a
strictly typed reference to the new callback VI.
6. Complete the block diagram of the callback VI to perform the
operation you specify when the control generates the event.
7. When the application finishes handling events for the control, use the
Unregister for Events function to close the event callback refnum
output of the Register Event Callback function.
Figure 6-1 shows how to register a callback VI to handle the Break event
for the TestStand Application Manager control.
You can resize the Register Event Callback function node to show multiple
sets of terminals to handle multiple events. Refer to the Simple OI -
Configure Event Callbacks and to the Full UI - Configure Event Callbacks
example user interface VIs for examples of registering and handling events
from the TestStand UI Controls.
You must limit the tasks you perform in a callback VI to ensure that
LabVIEW handles the event in a timely manner to allow the front panel to
quickly respond to user input and prevent possible hang conditions. When
a callback VI performs ActiveX operations that can process messages or
performs TestStand operations that can call back into LabVIEW, the
application must perform these operations outside of the callback VI. You
can define a user event the callback VI generates to defer these types of
operations.
The ReDraw user event in the full example user interface shows how
callback VIs can defer operations to perform outside of the callback VI.
The example user interface performs the following tasks:
• Calls the Full UI - Create LabVIEW Application Events VI to create
the ReDraw user event.
• Callback VIs, such as the Full UI - Resized Event Callback VI,
generate the ReDraw user event when the user interface must resize
and reposition controls on the front panel.
• The ReDraw User Event case in the main event loop of the Full UI -
Top-Level VI sets a global variable while processing the current event
to prevent callback VIs from generating new ReDraw events. The
ReDraw User Event case calls the Full UI - Disable Panel Updates VI
to prevent the front panel from updating, calls the Full UI -
ArrangeControls VI to update the position and size of controls on the
front panel, and calls the Full UI - Re-enable Panel Updates VI to
update the front panel.
© National Instruments Corporation 6-5 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 6 Creating Custom User Interfaces in LabVIEW
Typically, you stop a user interface application by clicking the Close box
or by executing the Exit command through a TestStand menu or a Button
control.
When you click the Close box, the Event structure in the main event loop
handles the Panel Close? event. The block diagram that handles the
event invokes the ApplicationMgr.Shutdown method and discards
the event. When the ApplicationMgr.Shutdown method returns True
to indicate TestStand is ready to shut down, the main event loop stops.
When the ApplicationMgr.Shutdown method returns False, the main
event loop waits because TestStand cannot shut down until the executions
complete or you unload sequence files. When TestStand is ready, the
Application Manager control generates the
ApplicationMgr.ExitApplication event.
Refer to the following example user interface VIs for examples of the main
event loop and how to shut down TestStand. These VIs also provide
examples of creating, generating, and handling the Quit Application event.
• Simple OI - Top-Level VI
• Simple OI - ExitApplication Event Callback
• Full UI - Top-Level VI
• Full UI - Create LabVIEW Application Events
• Full UI - ExitApplication Event Callback
Because maintaining the current state of the menu bar can be difficult,
National Instruments recommends that you handle the menu bar only when
required. The Event structure in a main event loop can include a case to
handle the Menu Activation? event to determine when you open a menu or
select a shortcut key that might be linked to a menu item. The block
diagram that handles this event can then rebuild the menu bar.
You can add a Menu Selection (User) case to the Event structure in a main
event loop to handle user menu selections but limit the tasks you perform
in the Menu Selection (User) case to ensure that LabVIEW handles the
menu selection in a timely manner. When the case performs ActiveX
operations that can process messages or performs TestStand operations that
can call back into LabVIEW, the application must perform these operations
in a LabVIEW execution system other than user interface, such as
standard or other 2.
© National Instruments Corporation 6-7 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 6 Creating Custom User Interfaces in LabVIEW
The LabVIEW application menu items for copy, cut, and paste operate on
LabVIEW controls only and do not operate on TestStand UI Controls. In
addition, the TestStand menu commands operate on TestStand UI Controls
only and not on LabVIEW controls. When you rebuild a LabVIEW menu
in the Menu Activation? event case and you call the TestStand - Insert
Commands in Menu VI to insert CommandKind_Edit_Copy,
CommandKind_Edit_Cut, or CommandKind_Edit_Paste, pass False
to the TestStand UI Control Has Focus control and "Edit" to the
Top-Level Menu to Insert Into control to insert the corresponding
LabVIEW application menu items instead of the TestStand menu
command.
Localization
The TestStand UI Controls and TestStand VIs and functions provide tools
that localize user interfaces based on the TestStand language setting. Use
the following VIs to localize the user interface:
• TestStand - Get Resource String
• TestStand - Localize Menu
• TestStand - Localize Front Panel
Refer to the Full UI - Localize Operator Interface and to the Full UI - About
Box example user interface VIs for examples of localizing user interfaces.
Use the TestStand - Start Modal Dialog and the TestStand - End Modal
Dialog VIs to make a dialog box modal to TestStand application windows.
Refer to the <TestStand Public>\Examples\ModalDialogs\
LabVIEW directory for examples of how to use these VIs.
Code modules can also allow TestStand to suspend the parent execution
without requiring the code modules to first return to TestStand.
Use the following VIs to enable VIs that TestStand calls to verify whether
the execution that called the VI has stopped:
• TestStand - Initialize Termination Monitor
• TestStand - Get Termination Monitor Status
• TestStand - Close Termination Monitor
Refer to the VIs in the following directories for examples of how to use
these VIs:
• <TestStand Public>\Examples\Demo\LabVIEW\Computer
Motherboard Test
• <TestStand Public>\Examples\Demo\LabVIEW\Auto
© National Instruments Corporation 6-9 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 6 Creating Custom User Interfaces in LabVIEW
you save a VI without the block diagram and the version of the VI is
different than the active version of LabVIEW installed on the
computer.
• By default, you can run only one copy of a LabVIEW-built executable
at a time, which prevents the TestStand /useexisting
command-line option from working. Add the
"allowmultipleinstances = TRUE" option to the INI options file
in the same directory as the LabVIEW built executable to allow more
than one copy to execute at a time.
• A LabVIEW user interface reports object leaks on shutdown when you
pass a TestStand object as the ActiveXData parameter of a UIMessage
in the UIMessage callback VI. LabVIEW does not release the object
reference until LabVIEW unloads the callback VI. Refer to the
National Instruments Web site at ni.com/info and enter the
info code 4H6DULT3 to access the National Instruments
KnowledgeBase article 4H6DULT3 for more information about using
a dynamically called VI to ensure that LabVIEW releases the object.
• To prevent a LabVIEW user interface from hanging while running in
LabVIEW, do not call subroutine VIs from inside a VI used as an
ActiveX callback VI. Instead, change the execution priority of the VIs
to a value other than subroutine.
Projects
When you run a VI in LabVIEW 8.0, the VI runs inside the application
instance for a target in a LabVIEW project or the VI runs without a project
in the main application instance. In TestStand, the LabVIEW Adapter
always runs a VI in the main application instance, and LabVIEW 8.0
project settings do not apply. TestStand does not support LabVIEW project
features or settings unless otherwise noted in the following sections.
© National Instruments Corporation 7-1 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 7 Using LabVIEW 8.x with TestStand
Project Libraries
LabVIEW project libraries are collections of VIs, type definitions, palette
menu files, and other files, including other project libraries. In TestStand,
you can call public VIs in a project library, but you cannot call private VIs.
To call a VI in a project library, you must specify the path to the VI file.
TestStand does not use qualified paths that include the project library path
and name.
Deploying Variables
You must deploy a project library that contains the shared variables to
which you want to connect from within a VI. LabVIEW automatically
deploys shared variables from a library when you execute a VI that reads
or writes shared variables and the project library that contains the shared
variables is open in the current LabVIEW project.
Note TestStand does not support calling a VI or DLL that programmatically deploys
shared variables using the LabVIEW Deploy Library method on a LabVIEW Application
reference or using the LabVIEW Deploy Items method on a LabVIEW Project reference.
When you programmatically deploy shared variables, the TestStand or LabVIEW
application might return an error and terminate. You can use the Deploy Library method
from within a standalone executable without adverse effects on TestStand.
The server you configured the LabVIEW Adapter to use in the LabVIEW
Adapter Configuration dialog box determines the aliases file LabVIEW
uses in the following ways:
• LabVIEW Run-Time Engine—LabVIEW looks for an aliases file
with the same name and location as the TestStand application. For
example, SeqEdit.aliases for the TestStand Sequence Editor and
TestExec.aliases for a user interface. You must quit and restart
the TestStand application after you copy the aliases file from the
project directory to the application directory.
• Development System—LabVIEW looks for an aliases file,
LabVIEW.aliases, located in the same directory as the LabVIEW
development system executable. You must quit and restart LabVIEW
after you copy the aliases file from the project directory to the
LabVIEW directory.
• Other Executable—LabVIEW looks for an aliases file with the same
name and location as the LabVIEW executable server. For example,
TestStandLVRTS.aliases for TestStandLVRTS.exe and
TestExec.aliases for a user interface. You must quit and restart
the executable after you copy the aliases file from the project directory
to the executable directory.
© National Instruments Corporation 7-3 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 7 Using LabVIEW 8.x with TestStand
XControls
TestStand supports calling VIs that use XControls on Windows systems.
Remote Execution
To execute VIs on a remote LabVIEW computer, TestStand requires a
version of the Remote Execution Support for NI TestStand component that
matches the version of LabVIEW with which you saved the VIs on the local
computer. LabVIEW installs and enables this component only when
TestStand is present. When you install TestStand after you install
LabVIEW, TestStand installs a version of the component that might not
match the version of LabVIEW on the computer. In this case, you might
need to rerun the LabVIEW installer.
Also, you must install a version of the Remote Execution Support for
NI TestStand component that matches libraries that you deploy using the
LabVIEW Utility Deploy Library step type.
© National Instruments Corporation 7-5 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 7 Using LabVIEW 8.x with TestStand
• When you build a TestStand deployment that calls VIs that use shared
variables, you must complete the following tasks:
– Add project library files that contain shared variables to the
workspace you use to create the deployment. While processing
sequence files, the TestStand Deployment Utility automatically
includes project library files in the deployment when a LabVIEW
Utility Deploy Library step references the project library.
– Add an aliases file to the deployment and configure the
deployment to install the aliases file to the proper location on the
destination system so LabVIEW can resolve network paths. Refer
to the Using an Aliases File section of this chapter for more
information about the correct location for the files.
– Include the NI Variable Engine component in the installer to
ensure that the destination system can use the shared variables.
– Deploy shared variables to the local computer by executing a
LabVIEW Utility Deploy Library step in a TestStand sequence.
You can also manually deploy shared variables to the local
computer using a project in the LabVIEW development
environment.
You cannot access the properties or invoke the methods on the flattened
LabVIEW string object in TestStand. To access the properties or invoke the
methods on the LabVIEW object, you must pass the flattened LabVIEW
object as a binary string to a VI and wire the string to the Unflatten From
String function along with the object constant of the correct type to create
the LabVIEW object.
© National Instruments Corporation 7-7 Using LabVIEW and LabWindows/CVI with TestStand
Calling LabVIEW VIs on Remote
8
Computers
You can directly call VIs on remote computers, including computers that
run the LabVIEW development system or a LabVIEW executable and PXI
controllers that run the LabVIEW Real-Time (RT) module. TestStand
supports downloading VIs to systems that run the LabVIEW 7.1.1 RT
module but does not support downloading VIs to systems that run the
LabVIEW 8.0 or later RT module. To use the LabVIEW 8.0 or later RT
module, you must call a VI on the local system and the local VI must then
call the VI on the LabVIEW RT module, or you must manually download
the VI to the LabVIEW RT module and call the VI by remote path or by
name if the VI is already in memory.
Because TestStand uses the LabVIEW VI Server to run VIs remotely, the
remote computers can use any operating system LabVIEW supports,
including Linux, Solaris (LabVIEW 7.1.1 only), and Mac OS.
To call a VI remotely, you must configure the TestStand step to specify that
the call occurs on a remote computer. In addition, you must configure the
remote computer to allow TestStand to call VIs located on the computer.
You must also configure the computer running TestStand to have network
access to the remote computer running the LabVIEW VI Server.
© National Instruments Corporation 8-1 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 8 Calling LabVIEW VIs on Remote Computers
Note Refer to the Getting Started with the LabVIEW Real-Time Module manual in the
<LabVIEW>\manuals directory for more information about downloading VIs to a PXI
controller.
You can also use FTP to download VIs to the PXI controller. Use the
LabVIEW development system to create a Source Distribution with all
the VIs to ensure that you include all the dependencies of the VIs to
transfer to the hard drive of the LabVIEW RT target. Disable the
options to exclude VIs from vi.lib, instr.lib, and user.lib.
Then, use FTP to transfer the source distribution output to the hard
drive of the LabVIEW RT target.
After you download the VIs to the PXI controller running the
LabVIEW 8.0 or greater RT module, you can use the Remote VI Path
option in the LabVIEW Advanced Settings window to call the VIs.
Use the VI Server: Exported VIs settings to configure the VIs you want to
call through the LabVIEW VI Server. You must export all VIs you want to
call remotely from TestStand. The default setting in LabVIEW is to export
all VIs, indicated by an asterisk (*).
In LabVIEW 8.0 or later, you can make changes to the LabVIEW VI Server
settings using LabVIEW projects. You must enable the TCP/IP Protocol
and specify the Machine Access, User Access, and Exported VIs settings.
When you finish configuring the RT target, set the execution target back the
to the local computer before you attempt to use TestStand to call VIs on the
RT target.
In addition, you must also configure the RT target to allow access to the
computer running TestStand when you want TestStand to download VIs to
the RT target.
© National Instruments Corporation 8-3 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 8 Calling LabVIEW VIs on Remote Computers
Invoking Methods
TestStand objects have methods you invoke to perform an operation or
function. In LabVIEW, use the Invoke Node to invoke methods.
The block diagram in Figure 9-1 shows how to invoke the
Sequence.UnloadModules method to unload all code modules in the
sequence.
© National Instruments Corporation 9-1 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 9 Using the TestStand ActiveX APIs in LabVIEW
Figure 9-2. Obtaining the Value of the Name Property from a Sequence Object
The block diagram in Figure 9-3 shows how to obtain a reference to a step
of a sequence that a Sequence object references.
The block diagram in Figure 9-4 shows how to use the GetValString
method on the PropertyObject interface of a Step object to obtain the
error message value for the current step.
Figure 9-4. Using the GetValString Method to Obtain the Error Message Value
for the Current Step
You can use the TestStand - Get Property Value VI or the TestStand - Set
Property Value VI to access dynamic properties of a SequenceContext
object. The block diagram in Figure 9-5 shows how to use the TestStand -
Get Property Value VI to obtain the error message value for the current step.
Figure 9-5. Using VIs to Obtain the Error Message Value for the Current Step
Note If you do not release the ActiveX reference, LabVIEW does not release it for you
until the VI hierarchy finishes executing. Repeatedly opening references to objects without
closing them can cause the computer to run out of memory.
© National Instruments Corporation 9-3 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 9 Using the TestStand ActiveX APIs in LabVIEW
Use the TestStand API String Constants VI to locate and select the string
constant arguments you can use with TestStand API properties and
methods. Use the TestStand API Numeric Constants VI to locate and select
the various numeric constant arguments you can use with TestStand API
properties and methods. Use both of these VIs in conjunction with the
constants associated with the TestStand API methods and properties. Refer
to the NI TestStand Help for more information about using constants with
the TestStand methods and properties.
The block diagram in Figure 9-4 shows how to use the TestStand
API Numeric Constants VI to obtain the value of the
PropOptions_NoOptions constant.
© National Instruments Corporation 9-5 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 9 Using the TestStand ActiveX APIs in LabVIEW
The block diagram in Figure 9-7 shows how to use a lookup string to obtain
a reference to a Step object from a SequenceContext object.
The reference in the global variable prevents TestStand from releasing the
referenced object until you explicitly close the reference in LabVIEW or
until TestStand unloads the code module into which it passed the reference.
© National Instruments Corporation 9-7 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 9 Using the TestStand ActiveX APIs in LabVIEW
Handling Events
TestStand User Interface (UI) Controls generate events to notify the
application of user input and application events, such as the completion of
an execution. To handle an event in LabVIEW, use the Register Event
Callback function to register a callback VI and then use the Unregister for
Events function to close the callback before you close the application.
You must assign each control and indicator of the test VI to a terminal on
the connector pane of the test VI. If these assignments do not exist,
TestStand returns an error when it attempts to call the test VI. TestStand
does not require that you use a particular connector pane pattern, and it does
not require that you assign the controls and indicators to specific terminals.
Although you usually create new VIs using the LabVIEW Module tab for
steps that use the LabVIEW Adapter, TestStand can also create
legacy-style VIs. Refer to Chapter 5, Configuring the LabVIEW Adapter,
for more information about configuring the LabVIEW Adapter to create
new legacy-style VIs.
You can use the following methods to pass data between the code module
and TestStand:
• Use the Test Data cluster
• Use the sequence context ActiveX reference to call the TestStand
ActiveX API functions to set the variables used to store the results of
the test, such as Step.Result.PassFail
Note The values the sequence context ActiveX reference sets take precedence over the
values the Test Data cluster sets. When you use both methods to set the value of the same
variable, TestStand recognizes the values the sequence context ActiveX reference sets and
ignores the values the Test Data cluster sets. You can use the sequence context ActiveX
reference and the Test Data cluster together in the code module if you do not try to set the
© National Instruments Corporation 10-1 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 10 Calling Legacy LabVIEW VIs
same variable twice. For example, when you use the sequence context ActiveX reference
to set the value of Step.Result.PassFail and then use the Test Data cluster to set the
value of Step.Result.ReportText, TestStand sets both values correctly.
Note The specific control and indicator labels described in this chapter are required.
Do not modify them in any way.
Table 10-1 lists the elements of the Test Data cluster, the data type of the
cluster element, and descriptions of how the LabVIEW Adapter uses each
cluster element.
The LabVIEW Adapter also supports an older version of the Test Data
cluster from the LabVIEW Test Executive. The LabVIEW Test Executive
Test Data cluster does not contain a Report Text element but instead
contains two string elements, Comment and User Output.
Table 10-2 lists the elements of the older Test Data cluster, the data type of
the cluster element, and descriptions of how the LabVIEW Adapter uses
each cluster element.
Table 10-2. Old Test Data Cluster Elements from LabVIEW Test Executive
Cluster
Element Data Type Description
Comment Output message to display in the report. The adapter copies
this message value into the Step.Result.ReportText
property when the property exists.
User Output String value the test VI returns. The adapter dynamically
creates the step property Step.Result.UserOutput and
copies the string value to the step property.
Table 10-3 lists the elements of the error out cluster, the data type of the
cluster element, and descriptions of how the LabVIEW Adapter uses each
cluster element.
Cluster
Element Data Type Description
status The test VI must set this element to True when an error
occurs. The adapter copies the output value into the
Step.Result.Error.Occurred property when the
property exists.
code The test VI can set this element to a non-zero value when an
error occurs. The adapter copies the output value into the
Step.Result.Error.Code property when the property
exists.
source The test VI can set this element to a descriptive string when
an error occurs. The adapter copies the output value into the
Step.Result.Error.Msg property when the property
exists.
© National Instruments Corporation 10-3 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 10 Calling Legacy LabVIEW VIs
Table 10-4 lists the elements of the Invocation Info cluster, the data type
of the cluster element, and descriptions of how the LabVIEW Adapter uses
each cluster element.
Cluster
Element Data Type Description
Test Name The adapter uses the name of the step that invokes the
test VI.
loop # The adapter uses the loop count when the step that invokes
the test VI loops on the step.
Sequence Path The adapter uses the name and absolute path of the
sequence file that runs the test VI.
UUT Info The adapter uses the value from the
RunState.Root.Locals.UUT.SerialNumber
property when the property exists. Otherwise, the adapter
copies an empty string. Refer to the NI TestStand Help for
more information about how to configure the Serial
Number String option in the Legacy VI Settings dialog
box.
UUT # The adapter uses the value from the
RunState.Root.Locals.UUT.UUTLoopIndex
property when the property exists. Otherwise, the adapter
copies an empty string. Refer to the NI TestStand Help for
more information about how to configure the UUT
Iteration Number option in the Legacy VI Settings dialog
box.
© National Instruments Corporation 10-5 Using LabVIEW and LabWindows/CVI with TestStand
Part II
© National Instruments Corporation II-1 Using LabVIEW and LabWindows/CVI with TestStand
Part II Using LabWindows/CVI with TestStand
© National Instruments Corporation 11-1 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 11 Calling LabWindows/CVI Code Modules from TestStand
1 2 3
Note National Instruments recommends using DLL files when you develop code modules
using the LabWindows/CVI Adapter. The tutorials in this manual demonstrate creating and
debugging only DLL code modules. Refer to Chapter 14, Configuring the
LabWindows/CVI Adapter, for additional requirements for calling functions in C source
files, object files, and static library files.
You also use the LabWindows/CVI Module tab to specify the function
prototype, which includes the data type of each parameter and the values
to pass for each parameter. The Parameters Table control shows all the
available parameters for the function call and an entry for the return value.
You can insert, remove, or rearrange the order of the parameters. The
Parameters Table control contains the following columns:
• Parameter Name—The symbolic name for the parameter.
• Description—The short description of the parameter type using
C syntax.
• Value Expression—The argument expression to pass.
When you select a parameter in the Parameters Table control, the Parameter
Details Table control contains the specific details about the parameter.
The data type (Numeric, String, Object, C Struct, or Array) determines the
information required for a parameter. As an alternative to specifying the
function name and the parameter values, you can use the Function Call
control to directly edit the function name and all the function arguments at
once.
The Source Code Files button launches the CVI Source Code Files dialog
box, in which you can specify the source file that contains the function the
step calls and to specify the project to use when editing the source code.
When the code module is a DLL or static library, you must enter the name
of the LabWindows/CVI project used to create the DLL or static library
file. When the code module is an object file, you can optionally specify a
project.
When you click the Create Code or Edit Code buttons, the
LabWindows/CVI Adapter launches a copy of LabWindows/CVI
and opens the source file. When you specify a project file using the Source
Code Files button, the LabWindows/CVI Adapter opens the project in
LabWindows/CVI when you click the Create Code or Edit Code buttons.
When you click the Create Code button for a function that already exists
in the file, TestStand uses the function you specified in the Code Template
ring control, and LabWindows/CVI launches the Generate Code dialog
box, in which you can specify to replace the current function or add the new
function above or below the current function.
© National Instruments Corporation 11-3 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 11 Calling LabWindows/CVI Code Modules from TestStand
Note If LabWindows/CVI returns a warning when you open a project that some TestStand
API files were not found, remove the files from the project and then add them again from
the <National Instruments>\Shared\CVI\instr\TestStand\API directory for
LabWindows/CVI 8.5 or later or from the <CVI>\instr\TestStand\API\CVI
directory for LabWindows/CVI 8.1.1 or earlier. The <National Instruments>
directory is located at C:\Program Files. The <CVI> directory is located at
C:\Program Files\National Instruments.
Click the Verify Prototype button to check for conflicts between the
parameterlistinthesourcecodeandtheparameterinformationontheModuletab.
Click the Help or Help Topic button on the Help toolbar to access the
NI TestStand Help, which provides additional information about the
LabWindows/CVI Module tab.
Note When you select a function, the LabWindows/CVI Adapter attempts to read the
export information LabWindows/CVI includes in the DLL or the function parameter
information from the type library in the code module if one exists. When the function
parameter information is not defined, you can select a code template from the Code
Template ring control to specify the function prototype or specify the function prototype
by adding parameters to the Parameters Table control.
© National Instruments Corporation 11-5 Using LabVIEW and LabWindows/CVI with TestStand
Creating, Editing, and
12
Debugging LabWindows/CVI
Code Modules from TestStand
Use the LabWindows/CVI Adapter to create new code modules to call
from TestStand and to edit and debug existing code modules.
© National Instruments Corporation 12-1 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 12 Creating, Editing, and Debugging LabWindows/CVI Code Modules from TestStand
5. Click the Source Code Files button to launch the CVI Source Code
Files dialog box and complete the following steps.
a. Enter CVINumericLimitTest.c in the Source File Containing
Function control.
b. For the CVI Project File to Open control, click the File Browse
button and select <TestStand Public>\Tutorial\
CallCVICodeModule.prj.
c. Click Close.
6. Click the Create Code button to create a code module. When you click
the Create Code button, TestStand launches the Select a Source File
dialog box.
7. Browse to the <TestStand Public>\Tutorial directory
and click OK. TestStand creates a new code module named
CVINumericLimitTest.c based on the available code templates
for the TestStand Numeric Limit Test and opens the code module in
LabWindows/CVI.
Note The TestStand Numeric Limit Test step type requires code modules to store a
measurement value in the Step.Result.Numeric property, and the step type performs a
comparison operation to determine whether the step passes or fails. Code modules can
update step properties by passing step properties as parameters to and from the module or
by using the TestStand API in the module. When you use a default code template from
National Instruments to create a module, TestStand creates the parameters needed to access
the step properties for you.
Refer to the Code Templates Tab section of Chapter 13, Custom Step
Types, of the NI TestStand Reference Manual for more information about
creating code templates for step types.
© National Instruments Corporation 12-3 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 12 Creating, Editing, and Debugging LabWindows/CVI Code Modules from TestStand
4. When the execution pauses, click the Step Into button on the sequence
editor toolbar. LabWindows/CVI becomes the active application, in
which the LabWindows/CVI Pass-Fail Test code module is open and
in a suspended state.
5. Click the Step Into button or the Step Over button on the
LabWindows/CVI toolbar to begin single-stepping through the code
module. You can click the Continue button at any time to finish
single-stepping through the code module.
6. When you finish single-stepping through the code module, click the
Finish Function button on the LabWindows/CVI toolbar to return to
TestStand. The execution pauses at the next step in the sequence.
7. Select Debug»Resume in TestStand to complete the execution.
8. Select File»Unload All Modules to unload the DLL.
9. Close the Execution window.
© National Instruments Corporation 13-1 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 13 Using LabWindows/CVI Data Types with TestStand
Note The LabWindows/CVI Adapter supports return values of type void and numeric,
which includes 32-bit doubles and 8-, 16-, and 32-bit integers.
You can pass NULL to a string pointer parameter by passing an empty object
reference or the constant Nothing.
The function the step calls can invoke methods and access the properties
on the object. You can pass the object parameter by value or by reference.
When the function stores the value of the object for later use after the
function returns, the function must properly add an additional reference
to the ActiveX Automation IDispatch Pointer or ActiveX Automation
IUnknown Pointer or duplicate the LabWindows/CVI ActiveX
Automation Handle. When you pass the object by reference and the
function alters the value of the reference, the function must release the
original reference.
Use the Struct Passing tab of the Type Properties dialog box for a custom
data type to specify how TestStand maps subproperties to members in
a C struct. When you specify the data to pass for the struct parameter on
the Module tab of the Step Settings pane, you only need to specify an
expression that evaluates to data with the data type.
© National Instruments Corporation 13-3 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 13 Using LabWindows/CVI Data Types with TestStand
© National Instruments Corporation 13-5 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 13 Using LabWindows/CVI Data Types with TestStand
8. Click the File Browse button next to the Module control and select the
<TestStand Public>\Tutorial\CallCVICodeModule.dll
file.
9. Enter PassStructTest in the Function control.
10. Click the Add Parameter button, shown at left, to insert a new
parameter and enter the following information in the Parameter Details
Table control:
a. In the Name field, rename the parameter cviStruct.
b. In the Category field, select C Struct.
c. In the Type field, select CVITutorialStruct.
11. Enter Locals.CVIStruct in the Value Expression field for the
parameter in the Parameters Table control.
12. Click the Source Code Files button to launch the CVI Source Code
Files window. Complete the following steps to select the source file
and project file to use when inserting the function.
a. In the Source File Containing Function control,
enter CVIStructPassingTest.c.
b. Click the File Browse button next to the CVI Project File to Open
option and select the <TestStand Public>\Tutorial\
CallCVICodeModule.prj file.
c. Click Close.
13. Click the Create Code button to create a code module. TestStand
launches the Select a Source File dialog box.
14. Browse to the <TestStand Public>\Tutorial directory and
click OK. TestStand creates a new source file named
CVIStructPassingTest.c with an empty function.
15. In LabWindows/CVI, complete the following steps.
a. Add the following type definition before the first function:
struct CVITutorialStruct {
double measurement;
char buffer[256];
};
b. Add the following code to the PassStructTest function:
if (cviStruct)
{
cviStruct->measurement = 10.0;
strcpy(cviStruct->buffer, "Average Voltage");
}
c. Add the following statement to the top of the source file to include
the declaration of the strcpy function:
#include <ansi_c.h>
16. Save and close the source file.
17. In the LabWindows/CVI project window, select Build»Create
Debuggable Dynamic Link Library to rebuild the DLL.
18. Return to the TestStand Sequence Editor.
19. Place a breakpoint on the new Pass Struct Test step.
20. Save the sequence file.
21. Select Execute»Run MainSequence to start a new execution of
MainSequence.
22. Single-step through the sequence and review the values in the
Locals.CVIStruct variable before and after executing the new step.
23. Select File»Unload All Modules to unload the DLL.
24. Close the Execution window.
© National Instruments Corporation 13-7 Using LabVIEW and LabWindows/CVI with TestStand
Configuring the
14
LabWindows/CVI Adapter
Configure the LabWindows/CVI Adapter to show function arguments in
step descriptions, set the default structure packing size, select where steps
execute, and establish a code template policy.
© National Instruments Corporation 14-1 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 14 Configuring the LabWindows/CVI Adapter
When you click Step Into in the TestStand Sequence Editor while the
execution is suspended on a step that calls into the DLL code module,
LabWindows/CVI suspends on the first statement in the called function.
© National Instruments Corporation 14-3 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 14 Configuring the LabWindows/CVI Adapter
You can configure the support libraries by performing one of the following
actions in the Auto-Load Library Configuration dialog box:
• Click the Add Default CVI Libraries button to search for an
installation of the LabWindows/CVI development environment and
copy the LabWindows/CVI static library files to the auto-load library
directory.
• Click the Add Other Libraries button to search for files to copy to the
auto-load library directory.
• Click the Delete Selected Files button to remove the selected files
from the auto-load library directory.
Note Data Execution Prevention (DEP) is a Windows security feature that prevents an
application from executing dynamically loaded code. TestStand does not support calling
LabWindows/CVI object and static library files from an executable with DEP enabled,
such as a custom user interface, and returns an error.
When you click Step Into in the TestStand Sequence Editor while the
execution is suspended on a step that calls into a LabWindows/CVI DLL
you are debugging, LabWindows/CVI suspends on the first statement in the
DLL function.
© National Instruments Corporation 14-5 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 14 Configuring the LabWindows/CVI Adapter
Note National Instruments does not recommend placing subordinate DLLs in the
directory that contains the application that loaded the adapter because TestStand might not
support loading DLLs from this location in future versions.
When you use the Edit LabWindows/CVI Module Call dialog box to create
code, such as in a Custom Sequence Editor, and multiple code templates are
available based on the step type and the code template policy settings,
TestStand launches the Choose Code Template dialog box, in which you
can select the code template to use for the new code module, as shown in
Figure 14-3.
Refer to the NI TestStand Help for more information about the Choose
Code Template dialog box.
© National Instruments Corporation 14-7 Using LabVIEW and LabWindows/CVI with TestStand
Creating Custom User Interfaces
15
in LabWindows/CVI
You can create custom user interfaces and create user interfaces for other
components, such as custom step types. Refer to Chapter 9, Creating
Custom User Interfaces, of the NI TestStand Reference Manual for more
information about the TestStand User Interface (UI) Controls.
© National Instruments Corporation 15-1 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 15 Creating Custom User Interfaces in LabWindows/CVI
Add the following function panel files to the LabWindows/CVI project for
your TestStand application:
• TestStand UI Controls (tsui.fp)—Functions for dynamically
creating controls, calling methods and accessing properties on
controls, and handling events from the controls.
• TestStand UI Support Library (tsuisupp.fp)—Functions for
various collections the TestStand UI Controls driver uses.
• TestStand Utility Functions (tsutil.fp)—Utility functions for
managing menu items that correspond to TestStand commands,
localizing strings in user interfaces, making dialog boxes associated
with LabWindows/CVI code modules modal to TestStand
applications, and checking if an execution that calls a code module has
stopped.
• TestStand API (tsapicvi.fp)—Provides low-level access to
TestStand objects.
For each interface the ActiveX control supports, the driver contains a
function you can use to programmatically create an instance of the ActiveX
control. The ActiveX driver also includes functions you can use to register
callback functions for receiving events the control defines.
When you store ActiveX controls in .uir files, you do not need to use the
creation functions the driver includes because the control is created when
you load the panel from the file using the LoadPanel function. You
identify the control in subsequent calls to User Interface Library functions
with the constant name you assigned to the control in the User Interface
Editor.
When you use other functions in the driver, you must identify the
control with a unique object handle that LabWindows/CVI then associates
with the control. You obtain this handle when you call the
GetObjHandleFromActiveXCtrl function using the constant name for
the control. This handle is cached in the control, and you do not need to
discard the handle explicitly.
User interfaces can also include a menu bar that contains non-TestStand
items and items that invoke TestStand commands.
Refer to the example user interfaces included with TestStand for more
information about creating a user interface using the TestStand UI Controls
in LabWindows/CVI. Begin with the simple user interface example,
<TestStand Public>\UserInterfaces\Simple\
CVI\TestExec.prj. Refer to the full-featured example, <TestStand
Public>\UserInterfaces\Full-Featured\CVI\TestExec.prj,
for a more advanced sequence editor example that includes menus and
localization options.
TestStand installs the source code files for the default user interfaces
in the <TestStand Public>\UserInterfaces and
<TestStand>\UserInterfaces directories. To modify the installed
user interfaces or to create new user interfaces, modify the files in the
<TestStand Public>\UserInterfaces directory. You can use
the read-only source files for the default user interfaces in the
<TestStand>\UserInterfaces directory as a reference. When you
modify installed files, rename the files after you modify them if you want
to create a separate custom component. You do not have to rename the files
after you modify them if you only want to modify the behavior of an
existing component. If you do not rename the files and you use the files in
a future version of TestStand, changes National Instruments makes to the
component might not be compatible with the modified version of the
component. Storing new and customized files in the <TestStand
Public> directory ensures that new installations of the same version of
TestStand do not overwrite the customizations and ensures that uninstalling
TestStand does not remove the files you customize.
© National Instruments Corporation 15-3 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 15 Creating Custom User Interfaces in LabWindows/CVI
TestStand no longer includes example user interfaces that do not use the
TestStand UI Controls. These examples contained a large amount of
complex source code, and they provided less functionality than the simpler
examples that use the TestStand UI Controls. National Instruments
recommends using the examples that use the TestStand UI Controls as a
basis for new development.
Handling Events
TestStand UI Controls generate events to notify the application of user
input and application events, such as the completion of an execution. To
handle an event in LabWindows/CVI, you register a callback function,
which LabWindows/CVI automatically calls when the control generates
the event. Use the Event Callback Registration functions in the
TestStand UI Controls driver to perform event registration.
For example, the following statement registers a callback function for the
OnExitApplication event sent from the Application Manager control:
TSUI__ApplicationMgrEventsRegOnExitApplication (
gAppMgrHandle, AppMgr_OnExitApp, NULL, 1, NULL);
The callback function can contain the following code, which verifies
whether the TestStand Engine is in a state where it can shut down:
HRESULT CVICALLBACK AppMgr_OnExitApp(
CAObjHandle caServerObjHandle, void *caCallbackData)
{
VBOOL canExitNow;
if (!TSUI_ApplicationMgrShutdown(gAppMgrHandle,
&errorInfo, &canExitNow) && (canExitNow))
QuitUserInterface(0);
return S_OK;
}
Handling Variants
Several functions in the TestStand API return variants. If the return
value of these functions is a reference to an ActiveX/COM object, you
must cast these variants to a valid handle type. To do this properly in
LabWindows/CVI, you must create a temporary variable to hold the value
and then convert the value to the correct type of handle.
© National Instruments Corporation 15-5 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 15 Creating Custom User Interfaces in LabWindows/CVI
tsErrChk(TS_UIMessageGetActiveXData(uiMsg, NULL,
&tempPropObject));
CA_CreateObjHandleFromInterface (tempPropObject,
&IID_IUnknown, 0, LOCALE_NEUTRAL, 0, 0,
&PropObject);
Error:
//free resources
if (PropObject)
CA_DiscardObjHandle(PropObject);
return error;
}
Typically, you stop a user interface application by clicking the Close box
or by executing the Exit command through a TestStand menu or a Button
control. For user interface events that request the user interface to close, the
user interface must call the TSUI_ApplicationMgrShutdown function
to unload sequence files, log out, and trigger an OnApplicationCanExit
event. When the function determines that the TestStand Engine can shut
down, the canExitNow output parameter returns True. The user interface
application then calls the QuitUserInterface() function, which causes
the preceding RunUserInterface() call to return. After the application
exits the function call to RunUserInterface(), the user interface
application must call TSUI_ApplicationMgrShutdown a second time to
complete the cleanup process and shut down the TestStand Engine.
Menu Bars
The TestStand Utility Functions provide the following set of functions for
creating and handling TestStand-specific menu items without requiring any
additional code:
• TS_InsertCommandsInMenu
• TS_RemoveMenuCommands
• TS_CleanupMenu
© National Instruments Corporation 15-7 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 15 Creating Custom User Interfaces in LabWindows/CVI
Localization
The TestStand UI Controls and TestStand Utility Functions drivers provide
tools that localize user interfaces based on the TestStand language setting.
Use the following functions to localize the user interface:
• TS_LoadPanelResourceStrings
• TS_LoadMenuBarResourceStrings
• TSUI_ApplicationMgrLocalizeAllControls
Use the following functions the TestStand Utility Functions driver provides
to make a dialog box modal to TestStand application windows:
• TS_StartModalDialogEx
• TS_EndModalDialog
Code modules can also allow TestStand to suspend the parent execution
without requiring the code modules to first return to TestStand.
Refer to the dialog box code in the following example source files for
examples of how to use this function:
• <TestStand Public>\Examples\Demo\C\computer.c
• <TestStand Public>\Examples\Demo\C\auto.c
© National Instruments Corporation 15-9 Using LabVIEW and LabWindows/CVI with TestStand
Using the TestStand ActiveX
16
APIs in LabWindows/CVI
You can use the TestStand API or TestStand UI Controls from
LabWindows/CVI code modules and user interface source code.
The driver functions you use to invoke methods and properties have a
special naming convention in which function names start with a prefix,
such as TS_. Methods are followed by the class name and the method name.
Properties are followed by Get or Set and the property name. In some
cases, the class, method, and property names are abbreviated to keep the
function name within the constraints of the .fp file format.
© National Instruments Corporation 16-1 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 16 Using the TestStand ActiveX APIs in LabWindows/CVI
Invoking Methods
TestStand objects have methods you invoke to perform an operation or
function. In LabWindows/CVI, you invoke methods on TestStand objects
using the functions defined in the ActiveX driver for those objects.
Note The functions, constants, and enumerations in the tsapicvi.fp driver begin
with the unique prefix TS_. This prefix is not included in the function, constant, and
enumeration names in the NI TestStand Help.
© National Instruments Corporation 16-3 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 16 Using the TestStand ActiveX APIs in LabWindows/CVI
© National Instruments Corporation 16-5 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 16 Using the TestStand ActiveX APIs in LabWindows/CVI
Note If you do not release the handle, LabWindows/CVI does not release the object for
you. Repeatedly opening references to objects without closing them can cause the
computer to run out of memory.
When you are concerned about a function returning a piece of data that
must be manually released, refer to the LabWindows/CVI Help or to the
NI TestStand Help for that function. Both of these resources explicitly state
if the function is allocating memory and often contain additional code
fragments explaining how to use the function.
The following example uses one of the previous functions and then releases
the memory:
char *stringVal = NULL;
TS_PropertyGetValString (propObj, &errorInfo,
"Step.Limits.String", 0, &stringVal);
...
CA_FreeMemory (stringVal);
The header file for the ActiveX driver defines all constants and
enumerations the methods and properties require. The constant
and enumeration names start with a prefix, such as TS_, followed by
the constant or enumeration name.
Note The functions, constants, and enumerations in the tsapicvi.fp driver begin
with the unique prefix TS_. This prefix is not included in the function, constant, and
enumeration names in the NI TestStand Help.
© National Instruments Corporation 16-7 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 16 Using the TestStand ActiveX APIs in LabWindows/CVI
Handling Events
TestStand User Interface (UI) Controls generate events to notify the
application of user input and application events, such as the completion of
an execution. To handle an event in LabWindows/CVI, you must register a
callback function using the event callback registration functions in
the instrument driver for an ActiveX control and then use the
CA_UnregisterEventCallback function to close the callback before
you close the application.
In addition, when you select a function in the DLL, the adapter queries the
export information or the type library for the parameter list information and
adds it in the Parameters Table control on the LabWindows/CVI Module
tab.
© National Instruments Corporation 17-1 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 17 Adding Type Libraries To LabWindows/CVI DLLs
6. Click OK to close the Type Library dialog box and to close the Target
Settings dialog box.
7. In the Project window, select Build»Create Debuggable Dynamic
Link Library to build the DLL.
© National Instruments Corporation 18-1 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 18 Calling Legacy LabWindows/CVI Code Modules
tTestData Structure
The tTestData structure contains input and output data, as shown in
Table 18-1.
In/
Field Name Data Type Out Description
result int Out Set by test function to indicate whether the test passed.
Valid values are PASS or FAIL. The adapter copies this
value into the Step.Result.PassFail property
when the property exists.
outBuffer char * Out Output message to include in the report. The adapter
copies this message value into the
Step.Result.ReportText property when the
property exists.
modPath char * const In Directory path of the module that contains the test
function. The adapter sets this value before executing
the code module.
modFile char * const In Filename of the module that contains the test function.
The adapter sets this value before executing the code
module.
seqContextDisp struct IDispatch * In Dispatch pointer to the sequence context. This value is
NULL when you choose not to pass the sequence
context.
In/
Field Name Data Type Out Description
stringMeasurement char * Out String value the test function returns. The adapter
copies this string into the Step.Result.String
property when the property exists.
structVersion int In Structure version number. A test module can use this
value to detect new versions of the structure.
Note Use the sequence context to access all the objects, variables, and properties in the
execution. Refer to the NI TestStand Help for more information about using the sequence
context from a LabWindows/CVI code module.
tTestError Structure
The tTestError structure contains only output error information, as shown
in Table 18-2.
In/
Field Name Data Type Out Description
errorFlag Boolean (int) Out The test function must set this value to True when an error
occurs. The adapter copies this output value into the
Step.Result.Error.Occurred property when the
property exists.
© National Instruments Corporation 18-3 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 18 Calling Legacy LabWindows/CVI Code Modules
In/
Field Name Data Type Out Description
errorCode int Out The test function can set this value to a non-zero value when
an error occurs. The adapter copies the output value into the
Step.Result.Error.Code property when the property
exists and the errorFlag is set.
errorMessage char * Out The test function can set this field to a descriptive string
when an error occurs. The adapter copies the output value
into the Step.Result.Error.Msg property when the
property exists and the errorFlag is set.
Note The values the sequence context ActiveX reference sets take precedence over the
values the tTestData structure sets. When you use both methods to set the value of the
same variable, TestStand recognizes the values the sequence context ActiveX reference
sets and ignores the values the tTestData structure sets. You can use the sequence context
ActiveX reference and the tTestData structure together in the code module if you do not
try to set the same variable twice. For example, when you use the sequence context
ActiveX reference to set the value of Step.Result.PassFail and then use the
tTestData structure to set the value of Step.Result.ReportText, TestStand sets both
values correctly.
© National Instruments Corporation 18-5 Using LabVIEW and LabWindows/CVI with TestStand
Chapter 18 Calling Legacy LabWindows/CVI Code Modules
© National Instruments Corporation A-1 Using LabVIEW and LabWindows/CVI with TestStand
Appendix A Technical Support and Professional Services
If you searched ni.com and could not find the answers you need, contact
your local office or NI corporate headquarters. Phone numbers for our
worldwide offices are listed at the front of this manual. You also can visit
the Worldwide Offices section of ni.com/niglobal to access the branch
office Web sites, which provide up-to-date contact information, support
phone numbers, email addresses, and current events.
Numerics debugging
DLLs in-process, 14-5
64-bit integer data types in LabVIEW 8.0, 7-4
from TestStand (tutorial), 12-3
in external instances, 14-3
A editing from TestStand (tutorial), 12-3
ActiveX executing
adding references in external instance, 14-2
(LabWindows/CVI), 16-5 in-process, 14-3
API, TestStand legacy, 18-1
LabVIEW, 9-1 loading subordinate DLLs (tutorial), 14-5
LabWindows/CVI, 16-1 object files, 14-3
releasing references object parameters, 13-3
LabVIEW, 9-3 selecting where to execute, 14-2
LabWindows/CVI, 16-5 static library files, 14-3
using LabWindows/CVI drivers, 16-1 stopped, 15-8
ActiveX controls (LabWindows/CVI) string parameters, 13-2
configuring, 15-1 structure parameters, 13-3
creating, 15-1 suspended, 15-8
programming, 15-1 Code Template Policy
adapters. See module adapters LabVIEW, 5-5
aliases file (LabVIEW), 7-3 LabWindows/CVI, 14-7
COM references, duplicating (LabVIEW), 9-6
Conditional Disable Structures and symbols
C (LabVIEW), 7-4
cluster parameters (LabVIEW), 4-4 constants
creating custom data types, 4-6 LabVIEW, 9-4
creating TestStand data types, 4-8 LabWindows/CVI, 16-7
passing as container variable, 4-5 container variables, passing to LabVIEW, 4-5
specifying cluster elements Controls palette (LabVIEW), 6-1
individually, 4-5 conventions used in the manual, iv
code modules (LabWindows/CVI), 1-1
C source files, 14-5
calling from TestStand, 11-1 D
creating from TestStand (tutorial), 12-1 data types (LabVIEW), 4-1
creating custom for clusters, 4-6
creating from clusters (tutorial), 4-8
© National Instruments Corporation I-1 Using LabVIEW and LabWindows/CVI with TestStand
Index
© National Instruments Corporation I-3 Using LabVIEW and LabWindows/CVI with TestStand
Index
P steps
creating and configuring (tutorial)
programming examples (NI resources), A-1
LabVIEW, 2-3
project libraries in LabVIEW 8.0, 7-2
LabWindows/CVI, 11-4
projects in LabVIEW 8.0, 7-1
showing function arguments
properties, accessing
(LabWindows/CVI), 14-2
built-in TestStand properties
updating properties
LabVIEW, 9-1
(LabWindows/CVI), 18-4
LabWindows/CVI, 16-3
stopped executions
dynamic TestStand properties
LabVIEW, 6-9
LabVIEW, 9-2
LabWindows/CVI, 15-8
LabWindows/CVI, 16-4
string parameters
PropertyObject class, acquiring derived class
LabWindows/CVI code modules, 13-2
in LabVIEW, 9-5
VIs, 4-4
prototypes, legacy (LabWindows/CVI), 18-1
struct parameters (LabWindows/CVI), 13-3
calling functions (tutorial), 13-5
R creating custom data types (tutorial), 13-4
real-time module incompatibility in setting default packing size, 14-2
LabVIEW 8.0, 7-1 suspended executions
remote computers (LabVIEW) LabVIEW, 6-9
calling VIs, 8-1 LabWindows/CVI, 15-8
configuring a LabVIEW RT Server, 8-3 symbols in LabVIEW 8.0, 7-4
configuring and running steps
(tutorial), 8-1
remote execution in LabVIEW 8.0, 7-4
T
technical support (NI Resources), A-1
Test Data cluster, legacy (LabVIEW), 10-2
S TestStand
Sequence Context control, legacy ActiveX API
(LabVIEW), 10-5 LabVIEW, 9-1
shared variables (LabVIEW), 7-2 LabWindows/CVI, 16-1
aliases file, 7-3 passing container variables to
deploying, 7-2 LabVIEW, 4-5
software (NI resources), A-1 shutting down in user interfaces
step properties, updating LabVIEW, 6-6
(LabWindows/CVI), 18-4 LabWindows/CVI, 15-6
step types, custom starting in user interfaces
LabVIEW, 1-2 LabVIEW, 6-6
LabWindows/CVI, 1-2 LabWindows/CVI, 15-6
<TestStand Public> directory, 2-3
TestStand API U
accessing
user interfaces
built-in properties
checking for suspended or stopped
LabVIEW, 9-1 executions
LabWindows/CVI, 16-3 LabVIEW, 6-9
dynamic properties LabWindows/CVI, 15-8
LabVIEW, 9-2 creating
LabWindows/CVI, 16-4 LabVIEW, 6-2
acquiring derived class from LabWindows/CVI, 15-3
PropertyObject class in LabVIEW, 9-5
custom
ActiveX drivers for
LabVIEW, 1-2, 6-1
LabWindows/CVI, 16-1
LabWindows/CVI, 1-2, 15-1
constants
Editor Mode, 6-4, 15-4
LabVIEW, 9-4
enabling sequence editing, 6-4, 15-4
LabWindows/CVI, 16-7
handling events
duplicating COM references
LabVIEW, 6-4
(LabVIEW), 9-6
LabWindows/CVI, 15-4, 16-8
enumerations
handling menu events (LabVIEW), 6-7
LabVIEW, 9-4
handling variants
LabWindows/CVI, 16-7
(LabWindows/CVI), 15-5
invoking methods
localization
LabVIEW, 9-1
LabVIEW, 6-8
LabWindows/CVI, 16-2
LabWindows/CVI, 15-8
LabVIEW, 9-1
menu bars
LabWindows/CVI, 16-1
LabVIEW, 6-7
obtaining interfaces for TestStand objects
LabWindows/CVI, 15-7
(LabVIEW), 9-5
modal dialog boxes
TestStand User Interface (UI) Controls
LabVIEW, 6-8
configuring
LabWindows/CVI, 15-8
LabVIEW, 6-3
running in LabVIEW, 6-9
LabWindows/CVI, 15-4
shutting down TestStand
LabVIEW, 6-1
LabVIEW, 6-6
LabWindows/CVI, 15-1
LabWindows/CVI, 15-6
training and certification (NI resources), A-1
starting TestStand
troubleshooting (NI resources), A-1
LabVIEW, 6-6
tTestData structure, legacy
LabWindows/CVI, 15-6
(LabWindows/CVI), 18-2
tTestError structure, legacy
(LabWindows/CVI), 18-3
type libraries, generating in LabWindows/CVI
(tutorial), 17-1
© National Instruments Corporation I-5 Using LabVIEW and LabWindows/CVI with TestStand
Index
V reserving, 5-4
running VIs remotely with LabVIEW RT
variables, deploying (LabVIEW), 7-2
Server, 8-3
variants, handling in user interfaces
running VIs remotely with VI Server, 8-2
(LabWindows/CVI), 15-5
setting access list for remote access, 8-4
VI Server, configuring (tutorial), 8-2
setting preferred execution system, 9-7
VIs
stopped, 6-9
calling from TestStand, 2-1
string parameters, 4-4
calling on remote computers, 8-1
suspended, 6-9
cluster parameters, 4-4
VIs and Functions palette (LabVIEW), 6-1
code modules, 1-1
configuring LabVIEW Adapter to
run, 2-1 W
creating from TestStand (tutorial), 3-1
Web resources (NI Resources), A-1
debugging from TestStand (tutorial), 3-3
editing from TestStand (tutorial), 3-2
LabVIEW Real-Time module, 8-1 X
legacy, 10-1
XControls in LabVIEW 8.0, 7-4
legacy settings, 5-7