Purpose

This example demonstrates how to use NI Session Manager to share named instrument handles between LabVIEW code modules.

Example File Location

<TestStand Public>\Examples\Interfacing with Hardware\Session Manager\LabVIEW\Session Manager.seq

Highlighted Features

  • IVI
  • NI Session Manager

Major API

None

Prerequisites

You must complete the following steps before you can run this example.

  1. Ensure that you have the LabVIEW development system installed and you configure the LabVIEW Adapter to use the LabVIEW development system.
  2. Install the following software:
    • Measurement & Automation Explorer (MAX)
    • IVI Compliance Package, including the LabVIEW Support portion of the IVI Class Drivers
  3. Complete the following steps to download and install an IVI-compliant instrument driver for the IVI DMM class that the example can use, such as hp34401a.
    1. Refer to the Instrument Driver Network at ni.com/idnet.
    2. Search for the manufacturer or the type of instrument you want to download. In MAX, the driver installer automatically creates a driver session entry under the Driver Sessions item and populates the software module information under the Instrument Driver Software Module item in the Advanced folder.
  4. Complete the following steps to create a logical name for the session.
    1. In MAX, expand the IVI Drivers category.
    2. Right-click the Logical Names item in the configuration tree and select Create New from the context menu.
    3. Complete the configuration panel for the new logical name, which is "SampleDMM". Logical names are case-sensitive. In the Driver Session control, specify the driver session you downloaded.

How to Use This Example

The Get DMM Session step obtains a reference to the session named "SampleDMM", which the Locals.logicalName local variable specifies. When the step creates the session, Session Manager initializes the instrument session and the step stores the reference in the DMM_Reference local variable so the session must continue to exist until the sequence completes.

The remaining steps in the sequence call code modules. Each code module calls Session Manager and obtains the instrument handle for the session the Locals.logicalName local variable specifies. Because the Get DMM Session step ensures that the session exists for the life of the sequence, each module uses the same session and the instrument initializes and closes only once.

Note Class drivers launch simulation dialog boxes if interactive simulation is enabled. These dialog boxes might not have taskbar items and can go behind the sequence editor. In addition, the IVI soft front panels remain visible until you close the Execution window.