Programmatically Retrieving A VISA Resource Name in LabVIEW

Updated Nov 26, 2018

Reported In

Software

  • LabVIEW

Driver

  • NI-VISA

Issue Details

I would like to be able to get the VISA resource name of my instrument or device without using Measurement & Automation Explorer (NI MAX) or having to make any selections from a drop-down menu. Is there a way I can retrieve the VISA resource name from LabVIEW programmatically?

Solution

There are two methods to retrieve the VISA resource name in LabVIEW:

Method 1: 

Use Visa Find Resource VI, which will query the system to locate the devices associated with a specified interface. You can find the Visa Find Resource VI by performing the following steps: 
  1. Right-click on the block diagram to bring up the Functions Palette.
  2. Choose the Instrument I/O sub-palette.
  3. Choose VISA»VISA Advanced»VISA Find Resource.
  4. Drop the Visa Find Resource VI onto the block diagram
 

Method 2:

You can also use the VISA property node. The image below shows steps below show how to access this property node:
  1. Right-click on the block diagram to bring up the Functions Palette.
  2. Choose the Instrument I/O sub-palette.
  3. Choose VISA»VISA Advanced»VISA Property Node
  4. Left click on Property
  5. Choose General Settings»Resource Name

Additional Information

This VI snippet contains code which demonstrates both methods:

 
Note: When using the first method, you can narrow your search for the VISA Resource by its Alias name or however it is specified in NI MAX. This is done by selecting the input for the VISA Find Resource function and making a control to change how you want to search for it. More information for this is in the LabVIEW detailed help. 

WAS THIS ARTICLE HELPFUL?

Not Helpful