From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

USB RAW AND VISA RESOURCE NAME

I have read the tutorial for creating a VISA Driver for USB RAW Devices; I have been able to control the instrument with LabVIEW 7.1 and the latest version of VISA. However, I am having a problem concerning the VISA resource name.
 
The USB device does not have its own serial number, therefore VISA assigns it the serial number is NI-VISA-#, where # is an automatically generated number. However, this number is not static. If I send a command to remotely reset the USB device, the serial number changes, and thus the VISA resource name is no longer valid. (The VISA Resource name is USB[board]::vendor code:: product code:: serial number[:: USB interface number]::RAW) This also happens if I turn the instrument on and off.
 
Is there anyway to make this serial number static, so I do not have to constantly query VISA to find the resource name?
 
Thanks for your help.
0 Kudos
Message 1 of 6
(5,644 Views)

You can't avoid that VISA resource name (in USB serial# part) dynamically changes for USB device that does not have serial#.  However its nams is virtually static as long as the device is attached on the same HUB on the same computer.  A good solution is use the VISA Alias feature for the device then communicates through the VISA alias instead of real VISA address, though it will be still needed to reconfigure the VISA alias whenever the real VISA address gets invalidated.  Also there is no way to distinguish multiple same devices connected to the same computer. 

0 Kudos
Message 2 of 6
(5,629 Views)
You could also do a viFindResources with your PID/VID within your program to programmatically detect your device. This would make it work regardless of your SN setting.
0 Kudos
Message 3 of 6
(5,608 Views)
Thanks for all of your suggestions.
 
I have tried using VISA Find Resources and it works well at the beginning of the program. However, I am running into some difficulties if I need to use it in the middle of the program.
 
For example, if I do a remote reset of the instrument, the VISA Resource name changes. If I run VISA Find Resources after resetting the instrument, I get the old VISA Resource name from the first query; I need to wait approximately 5 seconds before the VISA Find Resources gives me the correct VISA Resource Name. Is this a LabVIEW/VISA limitation or is there a way to speed this up?
 
Thanks again for your help.
0 Kudos
Message 4 of 6
(5,602 Views)
I think this is a kind of strange behaviour of the instrument, as it gets rebooted (or at least reset the USB chip) by remotely resetting the instrument.  A typical instrument normally resets its panel settings to the known default without rebooting itself, but your instrument shows different behaviour. It is a device specific problem and not concerned to VISA or LabVIEW operations.
 
Anyway, your software needs to wait for the instrument gets restarted for its USB initialization, Windows Plug&Play initiation, and loading the NI-VISA USB RAW device driver.  The 5 seconds wait in your case seems like needed for the instrument rebooting process, and VISA will only be able to success the next viFindResource() call after its wait.  An easy approach is just repeat viFindResource() until new VID/PID/SN is successfully found.

このメッセージは 10-18-2005 02:42 AMに Makoto が編集しています。

0 Kudos
Message 5 of 6
(5,596 Views)
Thanks for your help Makoto.
0 Kudos
Message 6 of 6
(5,577 Views)