Example Code

Programmatically Opening VISA Resources Based on Instrument Name

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.

    Hardware

  • Instrument Control

    Software

  • LabVIEW

    Driver

  • NI VISA

Code and Documents

Attachment

Overview
This example demonstrates how to programmatically open VISA resources based on the instrument name.

 
Description
Using the VISA Find Resources VI returns a list of VISA resources that do not provide any specific device information.  If you have a VI that you would like to run on multiple computers the COM port of the instrument might change, and you would have to manually reselect the instrument.  This VI programmatically selects the instrument based on a unique identifier chosen by the user.  This way you don't have to search for the instrument if you change computers or COM ports.

Requirements

Software:

  1. LabVIEW 2012 (or compatible)


Steps to Implement or Execute Code

  1. Run the VI with a blank input to unique string and look at the list of available instruments.
  2. Choose a unique string to the desired instrument and enter in as the Regular Expression input to the Match Pattern VI.

 

Additional Information or References
VI Snippet
Find Visa Resource Name 2012 NIVerified.png

 

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

Nick Keel
Product Manager - NI VeriStand and Model Interface Toolkit
National Instruments

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