Initialization

NI Switches Help

Edition Date: April 2015

Part Number: 375472H-01

»View Product Info
Download Help (Windows Only)

A call to initialize sets the switch to a known state and allows you to simulate the switch and reset the device. Initializing with the niSwitch Initialize With Topology VI or the niSwitch_InitWithTopology function also allows you to define the topology.

For any application you write, call the niSwitch Initialize With Topology VI or the niSwitch_InitWithTopology function to establish communication with the switch.

Use the niSwitch Initialize With Topology VI or the niSwitch_InitWithTopology function to establish a session with the switch and send initialization commands that set the instrument to the state necessary for NI-SWITCH operation. The niSwitch Initialize With Topology VI or the niSwitch_InitWithTopology function also verifies that NI-SWITCH supports the switch, resets the switch to a known state, returns a ViSession handle used to identify the instrument in all subsequent NI-SWITCH calls, and allows you to set the topology of the switch, including simulation.

The niSwitch Initialize With Topology VI and the niSwitch_InitWithTopology function override the topology for the switch module you set in Measurement & Automation Explorer (MAX). Refer to the NI Switches Getting Started Guide for information on configuring your switch module in MAX.

Resource Names

To establish a session with the correct switch module, you must pass a resource name to the niSwitch Initialize With Topology VI or the niSwitch_InitWithTopology function. The syntax of the resource name depends on where in MAX you configured your switch module—under Devices and Interfaces, Traditional NI-DAQ (Legacy) Devices, or PXI System.

Note  Existing NI-SWITCH applications may use additional suffixes in the resource name (such as ::SCANNER, ::INDEP, or ::MATRIX). While these suffixes are still supported, they are unnecessary with NI-SWITCH 2.0 and later. Refer to Legacy Programming for more information.

MAX Configuration Under Devices and Interfaces

If you configured the switch module under Devices and Interfaces in MAX, the resource name is the string in quotes. For example, the resource name of the NI SCXI-1190 in the following figure would be SC1Mod2. Pass this string to the niSwitch Initialize With Topology VI or the niSwitch_InitWithTopology function. You can rename the resource name for switch modules configured under Devices and Interfaces simply by clicking on the device in MAX and entering a new name.

MAX Configuration Under Traditional NI-DAQ (Legacy) Devices

If you configured the switch module in MAX under the Traditional NI-DAQ (Legacy) Devices category in the Configuration pane, the resource name syntax is:

SCXI[chassis ID]::[slot number]

For example, if the NI SCXI-1000 chassis in the previous figure had been configured under the Traditional NI-DAQ (Legacy) Devices category, the resource name of the NI SCXI-1190 would be SCXI1::2. "1" denotes the chassis ID and "2" the slot number. Pass this string to niSwitch Init With Topology.

Alternative Initialization Methods

You can also open a session to the switch module by calling the niSwitch Initialize VI or the niSwitch_init function, or by calling the niSwitch Initialize With Options VI or the niSwitch_InitWithOptions function. The niSwitch Initialize VI or the niSwitch_init function performs all the functionality of the niSwitch Initialize With Topology VI or the niSwitch_InitWithTopology function except that it does not set the topology of the switch. Instead, the driver uses the topology you set in MAX for the switch module. The niSwitch Initialize VI or the niSwitch_init function is available for those interested in maintaining IVI-compliance. For more information about IVI, refer to ivifoundation.org.

In addition to performing all the functionality of the niSwitch Initialize VI or the niSwitch_init function, the niSwitch Initialize With Options VI or the niSwitch_InitWithOptions function optionally sets the initial state of the switch. With the niSwitch Initialize With Options VI or the niSwitch_InitWithOptions function, you can configure the topology, range checking, caching, coercion recording, simulation, and status reporting. Refer to the option string (optionString) parameter of niSwitch Initialize With Options VI or the niSwitch_InitWithOptions function.

Once you have initialized the switch, you must configure it.

WAS THIS ARTICLE HELPFUL?

Not Helpful