Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

how do i tell labview to release a GPIB resource programmatically?

    Here's the problem:

I'm using labview to remotely control a GPIB device.  Everything is working the way that I want it to for that aspect.

However, At times, I also need to remotely control the device with a separate program that came with it.  Unfortunately, the device itself does not have a button that releases what is controlling it.  Even if I reset the device, labview reasserts control of the interface and stops me from controlling it with the other program.  The only way I can figure out how to get around this problem is to close labview entirely (which i don't really want to do).  As soon as I do that though, things work as they're supposed to.

Can anyone tell me how to do this programmatically in labview.  I'm sure I can just tell labview to release the resource or something...

thanks,
-z
0 Kudos
Message 1 of 6
(3,903 Views)
Hi

If you are using visa you can use the close function that releases LabVIEW control over the gpib device.
for the 488.2 functions I don't know
greetings from the Netherlands
0 Kudos
Message 2 of 6
(3,884 Views)
can anyone help me out while using the 488.2 functions?

thanks
-z
0 Kudos
Message 3 of 6
(3,860 Views)
What exactly do you mean that "labview reasserts control of the interface"? If your LabVIEW program is not running, I don't believe it would be doing anything to the interface. Do you have problems with the LV program stopped? What is the external program using for communication. If it's based on VISA, then you might want to use VISA in LabVIEW. You should be able to use NI-Spy to see what the other program is doing. You should also be able to integrate that code into your LabVIEW program.
0 Kudos
Message 4 of 6
(3,854 Views)

You can make a call to VISA32.DLL. The function is documented as:

ViStatus viGpibControlREN(ViSession vi, ViUInt16 mode)

0 Kudos
Message 5 of 6
(3,825 Views)
> ViStatus viGpibControlREN(ViSession vi, ViUInt16 mode)
 
This function can change remote/local state of the instrument, but it is not directly related to closing I/O session, though it must be a smart behaviour to enforce local state before exiting the remote app.  VISA close is the only function that closes the VISA session.
 
In NI-488.2M calls, I think there is no close function and you don't have to explicitly close the GPIB session.  Although there is ibonl(ud, v) function in the 488 API, which takes the 2nd param zero for meaning OFFLINE, I am not sure if it is such related to closing operation.
 
As for the issue that other program can't work correctly beside your LabVIEW app, it may be a different issue such as resource locking of the same session.  To clarify what is happening, capture the NI-SPY log for the 2 app programs and check to see what error is actually generated. 
 
0 Kudos
Message 6 of 6
(3,821 Views)