Change the Input Mode or Topology of a Switch Module Programmatically

Updated Aug 15, 2018

Reported In


  • PXI Switch Controller Module
  • PXI-2503


  • LabVIEW



Issue Details

Switch modules have different topologies: one-wire, 2-wire, 4-wire, matrix, multiplexer, or independent. During the execution of a program, sometimes I have to change the input mode or modify it several times while using the device. How can I select the mode or topology without using Measurement and Automation Explorer (NI MAX)?


To change the input mode of the switch cards programmatically, you must use the niSwitch_InitWithOptions function and select the proper DriverSetup. The code snippet below shows an initialization where the switch card (in this case a PXI-2503) is being configured as a 2-Wire Multiplexer:

status = niSwitch_InitWithOptions ("PXI::10::INSTR", VI_TRUE, VI_TRUE, "Simulate=1, DriverSetup=PXI-2503 2-Wire Mux", &instr);


Additional Information

The DriverSetup parameter defines the topology to be assumed by the module during the initialization. To determine which topologies are available for your switch, consult the product manual or the NI Switches Help. 

When changing the topology, you have to close the present session if one is open, and reinitialize the card with the new DriverSetup selected. 


Not Helpful