Using Signal Studio .NET APIs in LabVIEW

This topic provides instructions (outlined below) for using Signal Studio .Net APIs in LabVIEW.

Load .NET Mixed-Mode Assemblies

The .NET Framework 4.0 allows you to load pure managed assemblies built in any version of the .NET Framework and LabVIEW loads the .NET Common Language Runtime (CLR) 4.0 by default. However, for some Signal Studio applications, API usage involves assemblies that are not pure .NET CLR. In these cases, you must configure LabVIEW to load .NET mixed-mode assemblies using the following steps:

  1. Open a text editor.

  2. Copy the following text into the text editor:

    <?xml version ="1.0" encoding="utf-8" ?>

    <configuration>

    <startup useLegacyV2RuntimeActivationPolicy="true">

    <supportedRuntime version="v4.0.30319"/>

    </startup>

    </configuration>

  3. Save this new configuration file in the same directory as LabVIEW.exe. Typically the directory is C:\Program Files (x86)\National Instruments\LabVIEW 2014. Name the file LabVIEW.exe.config.

  4. Re-launch LabVIEW.

Creating .NET Objects in the Block Diagram

Signal Studio APIs do not provide graphical controls, so most of the usages of APIs should be done in the Block Diagram view of LabVIEW (Window > Show Block Diagram).

Step 1: Configure the Constructor Node

  1. Add the Constructor Node to the block diagram to launch the Select .NET Constructor dialog box.

  2. Select an assembly, objects, and constructors for a .NET object.

    First, right click the constructor and choose Select Constructor..., then browse to the Signal Studio software installation directory to select the assembly (.dll or .exe) that provides the API interfaces. Select the appropriate Object and Constructor.

    Choose which assembly, object, or constructor according to your testing needs and also by looking at the related API help contents shipped with the Signal Studio software.

    • API related topics in the main help file (Help > Contents)

    • API referenc help file (Help > API Reference)

Step 2: Configure Properties for Methods for the .NET Object

Right click the Constructor node to select a Method node.

Step 3: Wire the Added .NET Nodes

After all the needed nodes are created, wire them up (using the reference and error input/output connectors of the nodes) to execute the API test flow/procedure.

When wiring the whole test procedure up, you may need to add other nodes (e.g. a numeric constant), or a front panel control (in the Window > Show Front Panel view, to do runtime control) to the block diagram as appropriate.

Some properties may be “read only” so you may need to right-click the property and select Change To Write to assign value to the property.

Select Help > Show Context Help to open the Context Help window. Context Help is useful in wiring the correct type of node/control to the property node.

Your block diagram will look something like this:

Step 4: Run the VI

After all the nodes/controls are wired up correctly, you can try to run the VI by clicking the play button on the toolbar.

It is important to add a method node to call Dispose() as the last step in the block diagram to release/clean up some resources associated with the API usage.

Example LabVIEW VI using Signal Studio API

Use the multitone

An included LabVIEW VI example file loads an N7621B Multitone Distortion setting file and then downloads and plays the signal. See LabVIEW Example for Multitone Distortion for more information.

To run the VIs, LabVIEW and the Signal Studio software need to be installed on your PC.

.NET Topics in LabVIEW Help

Refer to the LabVIEW help for more detailed information about using .NET objects. The image below shows where to find this information or you search on "Creating .NET Objects on the Block Diagram."