Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

quirky GPIB-USB behavior - visa session connection lost

Hi,

 

I'm having problems with Labview 8, VISA and GPIB-USB-B interface.

I'm trying to use VISA VIs in Labview.

I'm doing the following:

1) communicate with instrument A without problems.

2) Unplug GPIB-USB from  PC.

3) connect GPIB interface to instrument B.

4) Plug GPIB-USB into PC

5) test instrument B communication in MAX without problems

6) I note that instrument A still shows in the drop-down list of the

"VISA resource name" control of the Labview VI even after

I refresh MAX and click "Refresh" entry in the "VISA resource name"

7) when I run the VI VISA resource name that corresponds to instrument

B, I would get a VISA error "VISA:  (Hex 0xBFFF00A6) The connection for the given session has been lost."

 

I have the latest drivers and windows XP pro updates

 

Also, when I unplug and plug back USB interface into the PC,

it runs windows new hardware wizard every time.

I find that annoying.

 

Fedor

0 Kudos
Message 1 of 13
(6,386 Views)
I question why you would want to unplug the USB-GPIB from the pc and why you would need to unplug instrument A before plugging in instrument B. Is there some reason you can't have instrument A and B connected all of the time? In any case, doing a refresh is not the same thing as doing a scan for instruments. The refresh will update your hardware list (GPIB, PXI, DAQ, USB boards) but will not do a new scan for instruments
0 Kudos
Message 2 of 13
(6,380 Views)

Dennis,

 

Thanks for your reply.

 

I am working on a portable, hot pluggable solution, that's why I'm testing my program

while connecting and disconnecting different instruments. I am pulling the USB

plug to power GPIB bus down as GPIB require to power

down the devices before connecting/disconnecting GPIB cable.

 

  

I would like to rephrase my question:

What is the correct protocol for handling  

old/new/expired VISA connections in Labview 8?

 

I could not find the answer by using search or

looking up examples.

 

Fedor.

0 Kudos
Message 3 of 13
(6,378 Views)
Have you found any solution on this? I am having the same problem. I communicate to an instrument through USB-serial port device, and after a while, I will get this "the connection for the given session has been lost." error.
0 Kudos
Message 4 of 13
(6,307 Views)

DGU,

No, I have not found a solution. I gave up on trying to use VISA and switched to old-style GPIB VIs.

Fedor. 

0 Kudos
Message 5 of 13
(6,296 Views)

And because the old style gpib is built upon the visa layer it should have the same problems at least from labview 7.1

The usb unplug and replug is not a very nice test, but could work.

Will the next test be to unplug the power of the pc or the instrument? I guarantee a non working system after that.

greetings from a second nice day in the Netherlands

 

greetings from the Netherlands
0 Kudos
Message 6 of 13
(6,288 Views)


@Albert Geven wrote:

And because the old style gpib is built upon the visa layer it should have the same problems at least from labview 7.1



Actually the GPIB function in LabVIEW do not depend on VISA at all.  VISA is used for serial communications, but the GPIB functions go directly to the GPIB driver.
If you are looking to identify the currently connected instruments, the 488.2 FindLstn command should work well for you.  After locating the connected listeners, you could always use VISA commands to communicate with it by forming the resource string yourself.

Jason S.
Applications Engineer
National Instruments
0 Kudos
Message 7 of 13
(6,269 Views)

Hi

Thanks for the info, I really thought the gpib driver was using the visa layer.
What is the reason it still is necessary to directly use this, compatibilty with previous programs or is there another reason?

greetings from the Netherlands
Message 8 of 13
(6,263 Views)
Hi Albert,

NI-VISA relies on NI-488.2 to actually interface with the hardware.  NI-VISA doesn't include hardware drivers itself, but rather relies on other drivers which exist on the system.  NI-VISA relies on drivers such as the Windows Serial API, NI-488.2, and NI-VXI to actually communicate with your hardware resource.  While I do not know all the reasons that LabVIEW always uses VISA for serial communication, I imagine that it has something to do with being able to easily port the functionality to other platforms, so that the low-level serial functionality only needs to be updated in NI-VISA, and not in LabVIEW as well.

The GPIB functions also provide a lower level of control than is available with NI-VISA, so while NI-VISA improves usability, some operations may require the use of the low level 488.2 functions.

Jason S.
Applications Engineer
National Instruments
0 Kudos
Message 9 of 13
(6,260 Views)

Hi Jason

thanks for reminding me.

The reason I like (love/hate) VISA is the ability to write instrumentdrivers and don't worry too much about the bus/interface but concentrate at the commands.
The way VISA hides the interface and let me concentrate on the message makes it also possible to reuse most (95%) of the driver when adding an interface.
Especially the new instruments that come out with usb and gpib and ethernet are perfect to control with visa.

Except for a few quircks now and then but that happened also with old instruments in the normal gpib driver.

greetings from the Netherlands
0 Kudos
Message 10 of 13
(6,251 Views)