Solution
This error indicates that control of the VISA resource (e.g., the serial port, GPIB port, Ethernet port, etc.) could not be taken. It can occur in the LabVIEW Development Environment, a built executable, on a remote target, or in NI MAX.
This article will provide troubleshooting guidance for each environment.
General Troubleshooting
- Another program may have control over the VISA resource. Only one program can use the resource at a time. Close other programs that may be using the resource, such as NI MAX VISA Test Panels, PuTTY, or HyperTerminal.
- Be sure to close your NI-VISA session in your application. After running an NI-VISA application, LabVIEW does not release the VISA resource by default.
- Use NI VISA Close to close your device session at the end of your program.
- You can configure your LabVIEW environment to automatically close VISA sessions by navigating to Tools >> Options >> Environment and checking Automatically close VISA sessions.
- Quitting LabVIEW entirely will also close all VISA sessions.
- If the VISA resource is disconnected, close the VISA session and then run your application again.
- Check the compatibility of your operating system 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 be caused by driver installation issues or corruption. Try Force Reinstalling NI-VISA .
- Make sure your Windows operating system is up to date by running System Updates.
Serial Troubleshooting
- If working with a serial device, try restarting your computer. This will force the operating system to release the serial resource.
- Try modifying the COM Port Number through Windows Device Manager. To do this, open Windows Device Manager >> Ports (COM & LPT) >> Right-Click over the COM device >> Properties >> Port Settings >> Advanced >> COM Port Number:
- Note: Modifying the COM Port Number may cause unexpected behavior in other applications which use the same resource.
Executables
- If you are running a LabVIEW executable, and the LabVIEW Development Environment is open at the same time, the development environment may already have control of the resource. You will need to quit out of the development environment, or close your NI-VISA sessions, before running the executable.
- If this is the case, you may still be able to run another VI using the resource from LabVIEW, but not an executable.
- There may be a configuration mismatch between the LabVIEW Development Environment and the executable.
- 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).
- Edit the first line from [LabVIEW] to [name].
Remote Targets (CompactRIO or PXI(e) Devices)
- 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.
- Some devices, such as some cRIOs, have a physical DIP switch for enabling or disabling the Console Out option. Refer to your device manual if you do not see a Console Out setting in NI MAX.