This content is not available in your preferred language.

The content is shown in another available language. Your browser may include features that can help translate the text.

NI-VISA Error -1073807246 Cannot Access Resource

Updated Mar 8, 2019

Reported In

Hardware

  • CompactRIO Controller
  • Serial Interface Device
  • PXI Serial Interface Module
  • C Series Serial Interface Module
  • USB Cable
  • CompactDAQ Controller

Software

  • LabVIEW

Driver

  • NI-VISA

Issue Details

I am trying to communicate with my third party instrument. VISA Test Panels are working in NI MAX, but I get the following error when I use the VISA example VIs.

-1073807246: The resource is valid, but VISA cannot currently access it.
OR

I am getting Error 37: Device Not Found when using the Serial Compatibility VIs. How do I resolve the error? 
 

Why am I getting one of these errors and how can I eliminate it?

Solution

You can get this error both in the LabVIEW Development Environment as well as from a built executable. It indicates that LabVIEW could not take control of the Serial Port.

The following are the possible causes as well as the solutions to these errors:
  • Another program has control over the serial port. Only one program can use the serial port at a time. Close other programs that may be using the serial port, such as HyperTerminal or any NI MAX VISA Test Panels. Automatically close VISA sessions in LabVIEW by navigating to Tools -> Options -> Environment and checking "Automatically close VISA sessions."
  • If you are running an executable built in LabVIEW and LabVIEW is open, LabVIEW may already have control of the serial port. After using a serial VI the default behavior of LabVIEW is to not release the serial port. You can still run another VI using serial from LabVIEW, but not an executable. In order to release the serial port, you must do one of the following:
    • Close LabVIEW. Closing all the VIs that use serial VIs is not enough to release the port. By closing LabVIEW completely, you are force closing all the sessions that have been opened by LabVIEW.
    • Use the VISA Close VI in the VISA Advanced palette.
  • If you lose connection to the COM port, and then reestablish connection, the VISA resource will need to be closed and then reopened before accessing it.
  • For CompactDAQ and CompactRIO controller users, make sure Enable Console Out is not checked in the MAX System Settings.  If this is enabled, VISA will be unable to control the serial port.
  • If you are using a serial converter or have built your own custom serial converter, ensure that you have correctly connected the serial port lines
  • The file serpdrv is not available (only for LabVIEW 6.1 and earlier Serial Compatibility VIs).
    • When running the VI from LabVIEW, serpdrv should be located in the directory specified by libdir (usually National Instruments\LabVIEW\)
    • When using an executable built from LabVIEW, serpdrv needs to be either in the same directory as the executable or in the same directory as the run-time engine. The common directory of the run-time engine is: National Instruments\Shared\LabVIEW Run-Time
  • For executables, copy the LabVIEW.ini file (located in Program Files\National Instruments\LabVIEW 20[XX]\LabVIEW.ini) to the folder of the executable. Rename it to have the same name as the executable (name.ini) and edit the first line from [LabVIEW] to [name].
  • Check the compatibility of your operating system (OS) and NI-VISA driver. This can be found in the readme for your version of NI-VISA. If your version of NI-VISA is not compatible with your operating system, this may be causing the error and you need to upgrade your driver.  
  • This error can also occur if the COM port is not being recognized appropriately by the driver due to a driver issue. Try Force Reinstalling NI-VISA.

Additional Information

These solutions also help resolve Error 37: Device Not Found that occurs when using Serial Compatibility VIs. These VIs have been deprecated so the error is only mentioned here as a note. If receiving the same error message in NI MAX, or for additional troubleshooting steps, please refer to the article titled COM Port in MAX Shows Exclamation Point.

If you are using CompactRIO, this is caused by enabling Console Out. Please check the startup setting or dip switch of cRIO.
 

WAS THIS ARTICLE HELPFUL?

Not Helpful