Example Code

NI SwitchBlock: NI-SWITCH Example for Single 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 an NI SwitchBlock device using NI-SWITCH.



  1. Initializes your NI SwitchBlock device and sets its 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 and analog bus lines for routing in preparation to connect over these rows and analog buses on your NI SwitchBlock device.
  4. Makes a connection from one column to another, and waits for the switch to finish closing.
  5. Terminates the NI-SWITCH session and 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



Steps to Implement or Execute Code

To make this example work with your switch, complete the following:

  1. Select your NI SwitchBlock device name, ‘Configured Topology’, and your columns to connect
  2. Run the VI and the connections will be made through the rows and analog bus lines available

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


I/O Connections Overview:

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

Additional Information or References

Block Diagram

NI-Switch 1 Device Endpoint.png


**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.