niSwitch Initialize With Options

NI-SWITCH LabVIEW

niSwitch Initialize With Options

Returns a session handle used to identify the switch module in all subsequent NI-SWITCH calls and optionally sets the initial state of the session.

This VI creates a new IVI instrument driver session for the switch module specified in the resource name. If multiple topologies are valid for that device, NI-SWITCH uses the default topology specified in MAX. The topology is also configurable in option string.

By default, the switch module is reset to a known state.

Enable simulation in option string.

An error is returned if a session to the specified resource exists in another process. The same session is returned if this VI is called twice in the same process for the same resource with the same topology.

resource name specifies the resource name of the switch module to initialize.

Syntax:

Optional fields are shown in square brackets ([]). The default values for optional fields are as follows:

chassis ID = 1

bus number = 0

Configured in MAX UnderValid Syntax
NI-DAQmx DevicesDAQmxDeviceName
Traditional NI-DAQ (Legacy) DevicesSCXI[chassis ID]::slot number
PXI SystemPXI[bus number]::device number
Tip  IVI logical names are also valid for the resource name.

The following table provides example resource names.

Resource NameDescription
SC1Mod3NI-DAQmx module in chassis "SC1" Slot 3
MySwitchNI-DAQmx module renamed to "MySwitch"
SCXI1::3Traditional NI-DAQ (Legacy) module in chassis 1, Slot 3
SCXI::3Traditional NI-DAQ (Legacy) module in chassis 1, Slot 3
PXI0::16PXI bus 0, device number 16
PXI::16PXI bus 0, device number 16

id query is ignored.

Because NI-SWITCH supports multiple switch modules, it always queries the switch module to determine which switch is installed. For this reason, this VI may return an ID Query Failed error even if this parameter is set to VI FALSE.

reset device specifies whether to reset the switch module during the initialization process.

TRUE (default)The device will reset.
FALSECurrently unsupported. The device will not reset.
error in describes error conditions that occur before this VI or function runs. The default is no error. If an error occurred before this VI or function runs, the VI or function passes the error in value to error out. This VI or function runs normally only if no error occurs before this VI or function runs. If an error occurs while this VI or function runs, it runs normally and sets its own error status in error out. Use the Simple Error Handler or General Error Handler VIs to display the description of the error code. Use error in and error out to check errors and to specify execution order by wiring error out from one node to error in of the next node.
status is TRUE (X) if an error occurred before this VI ran or FALSE (checkmark) to indicate a warning or that no error occurred before this VI ran. The default is FALSE.
code is the error or warning code. The default is 0. If status is TRUE, code is a non-zero error code. If status is FALSE, code is 0 or a warning code.
source describes the origin of the error or warning and is, in most cases, the name of the VI or function that produced the error or warning. The default is an empty string.

option string sets initial values of certain properties for the NI-SWITCH session.

The following table lists the property string names you can use:

Property String Name Default Value
RangeCheck1
QueryInstrStatus 1
Cache 1
Simulate 0
RecordCoercions0
DriverSetuptopology:1127/2-Wire 32x1 Mux

The format of option string is, "PropertyStringName=Value", where PropertyStringName is the name of the attribute shown above and Value is the value to which the property is set. To set multiple properties, separate assignments with a comma.

If you pass an empty string option string, the NI-SWITCH session uses the default values for the properties. You can override the default values by explicitly assigning a value. You do not have to specify all of the available properties. If you do not specify an attribute, its default value is used.

Use the DriverSetup property to set the topology or the resource type (DAQmx or Traditional DAQ) of the switch module. This attribute can contain config token/value pairs within it.

DriverSetup=[config token]:[value];[config token 2]:[value 2]

Valid Config Tokens and Values:

TokenValue
topologyRefer to Devices for valid values. Default: MAX configured topology for each device.
resourcetype"daqmx" for devices configured under NI-DAQmx Devices in MAX or "legacy" for devices configured under Traditional NI-DAQ (Legacy) Devices in MAX. Default: daqmx

For example, use the following string to set an NI SCXI-1127 as a 2-wire 32x1 multiplexer configured in MAX under DAQmx Devices:

DriverSetup=topology:1127/2-Wire 32x1 Mux;resourcetype:daqmx

The DriverSetup string is particularly important when using NI-SWITCH through the IviSwtch class driver.

To enable simulation, set the Simulate property equal to 1 and specify the switch module and topology of the switch module to simulate. The following string enables simulation for an NI SCXI-1127 configured as a 2-wire 32x1 multiplexer.

Simulate=1, DriverSetup=topology:1127/2-Wire 32x1 Mux

If the simulate property is set to 1 and the DriverSetup property specifies a topology, the topology is used to determine which switch module to simulate. If the DriverSetup property does not specify a topology, the switch specified in resource name is simulated.

instrument handle out identifies a particular NI-SWITCH session established with niSwitch Initialize With Topology, niSwitch Initialize With Options, or niSwitch Initialize and used for all subsequent NI-SWITCH calls.
error out contains error information. If error in indicates that an error occurred before this VI or function ran, error out contains the same error information. Otherwise, it describes the error status that this VI or function produces. Right-click the error out indicator on the front panel and select Explain Error from the shortcut menu for more information about the error.
status is TRUE (X) if an error occurred or FALSE (checkmark) to indicate a warning or that no error occurred.
code is the error or warning code. If status is TRUE, code is a non-zero error code. If status is FALSE, code is 0 or a warning code.
source describes the origin of the error or warning and is, in most cases, the name of the VI or function that produced the error or warning.