Example Code

Programatically Perform MAX Scan for Instruments for LabVIEW

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.


  • LabVIEW


  • NI 488.2

Code and Documents


Download All


This example mimics the VISA functions used when you use the "scan for instruments" function in NI-MAX.



Occasionally some problems with VISA can be rectified by selecting an interface in MAX, (Such as a GPIB interface) right clicking, and selecting scan for instruments. This sends low level commands that perform some configuration steps for the interface, preparing it for use. The attached code allows you to perform the majority of low level commands by calling a dll in LabVIEW.



  • LabVIEW 2013 (or compatible) 


Steps to Implement or Execute Code

  1. Run the main program.
  2. Notice that the program calls a dll
  3. The dll contains the necessary GPIB commands that mirror the scanning for instruments in NI-MAX


Additional Information or References.

When selecting scan for instruments in MAX, NI IO Trace reveals the following command sequence:


Using an example, findinstruments.c, it was possible to adapt the code to perform most of these commands. This was then compiled into a dll, so that it could be called using the Call Library Function Node. The IO Trace result of calling this function can be seen below:




As you can see, this contains most of the useful configuration steps that would be initiated if you selected the option in MAX.


The following is the block diagram used for this example:



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

Matt H
Applications Engineer
National Instruments UK

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