VISA Find Resource Function Takes a Long Time to Execute

Updated Aug 17, 2023

Reported In

Software

  • Measurement & Automation Explorer (MAX)
  • LabVIEW

Driver

  • NI-VISA

Issue Details

  • When I use the VISA Find Resource function in LabVIEW™ it takes over 10 seconds to complete where before it would take less than a second. 
  • Whenever I disconnect a real-time target from my PC or network, the VISA Find Resource is very slow to respond. How can I get around this?
  • How can I prevent VISA Find Resources from searching for serial ports that are no longer present?

Solution

The VISA Find Resource function can take longer to execute if the NI MAX Database is corrupt, or if there are disconnected devices listed in NI MAX.

The following options can be implemented to speed up the execution time:
 
  1. Delete any disconnected devices in NI MAX before running the LabVIEW code.
  2. Reset the MAX Configuration Database before executing the VISA Find Resource function.
  3. Delete the VISA configuration file (visaconf.ini) and re-open NI MAX to force the generation of a new configuration file.
    • visaconf.ini is located in C:\ProgramData\National Instruments\NIvisa.
    • This option can be implemented programmatically by using the Delete Function to delete the file and the System Exec VI to re-launch NI MAX.
  4. It may also be more suitable to use the System Configuration API to identify resources and hardware instead.
    • The Find Hardware VI returns a list of hardware connected to the specified system and it's execution time is not negatively effected by the presence of disconnected devices.
    • Note: the System Configuration VIs generally take longer to execute than the VISA Find Resource function.