From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

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.

    Software

  • LabVIEW

    Driver

  • NI 488.2
  • NI VISA

Code and Documents

Attachment

Overview

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

 

Description

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.

 

Requirements

  • 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:

 Capture.PNG

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:

 

Capture.PNG

 

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:

Capture.JPG

 

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