Error -1073807246 Using NI-VISA

Updated Nov 9, 2018

Reported In

Hardware

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

Software

  • LabVIEW

Driver

  • NI-VISA

Issue Details

I am trying to communicate with my third party instrument. I get the following error when I use the VISA VIs:

-1073807246: The resource is valid, but VISA cannot currently access it.
Why am I getting this error and how can I eliminate it?
 

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

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

This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW Block Diagram.
  • 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