Example Code

NI SwitchBlock: NI-SWITCH Example for Multiple Device Endpoint Connections

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.


  • Modular Instrumentation


  • LabVIEW


  • Other

Code and Documents



This VI will make an endpoint connection from one column to another in multiple NI SwitchBlock devices using NI-DAQmx.



The following are steps illustrated on the block diagram of this example:


  1. Opens a session to both switch devices and sets their topology to the one you specify in Topology Name.
  2. Creates an array of row names and an array of analog bus names for your specific device.
  3. Reserves all of the rows for routing in preparation to connect over these rows on your NI SwitchBlock device.
  4. Allows the sharing of your analog bus over multiple devices.
  5. Makes a connection from one column to another and waits for the switch to finish closing.
  6. Terminates the NI-SWITCH session and stops the task.
  7. Handles any errors that have occurred.



  LabVIEW version 2012 (or compatible)
  NI-Switch Driver version 4.6 (or compatible)
  NI SwitchBlock and NI SwitchBlock Modules

  Refer to the NI Switches Getting Started Guide and NI Switches Help for information about connecting signals to your switch module


Steps to Implement or Execute Code

  1. Select your NI SwitchBlock device name, 'Configured Topology', your column to connect, and the analog bus to use in this connection
  2. Repeat step 1  for both NI SwitchBlock devices that you are using
  3. Run the VI and the connections between the two devices will be made

Refer to the NI Switches Help for the valid channel for your switch module.



Additional Information or References

Block Diagram


**This document has been updated to meet the current required format for the NI Code Exchange.**

National Instruments
Software Group Manager

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.