Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Concurrent Access to GPIB interface

I want to built 2 Labview (5.1) applications (.exe) sharing the same GPIB Interface.
But there is a conflict when accessing the GPIB interface.
How can I manage this concurrent access to the interface?
Is there any GPIB function which can monitor the availability of the GPIB interface?
0 Kudos
Message 1 of 5
(4,172 Views)
Hello-

NI-Spy displays which process and thread makes each VISA and GPIB call. The recent versions of the GPIB driver are thread-safe. It's also possible to have multiple processes access GPIB.

The viLock and viUnlock functions in VISA might be useful for this particular application. See the NI-VISA Programmer's Reference Manual (available at ni.com/manuals) for more details.

Randy Solomonson
Applications Engineer
National Instruments
0 Kudos
Message 2 of 5
(4,172 Views)
Each of GPIB access (through ni488.2m, agilent i/o, visa, etc) is
thread safe. But if your two apps indpendently access the instr
with a query/response pair, it may conflict.

Imagine that one app posts "*idn?" and retrieves its response,
and another app posts ":xxxx:voltage?" and its response at a time.
These combinations can't be protected therefore your apps may
be confused by unxpected responses depending upon operation
timing. You need add lock/unlock mechanism if your problem
is like this.

makoto


"jcr" wrote in message
news:50650000000800000056390000-1011517314000@exchange.ni.com...
> I want to built 2 Labview (5.1) applications (.exe) sharing the same
> GPIB Interface.
> But there is a conflict when accessing the GPIB interface.
> How can
I manage this concurrent access to the interface?
> Is there any GPIB function which can monitor the availability of the
> GPIB interface?
0 Kudos
Message 3 of 5
(4,172 Views)
That's a good point, you should be able to access the interface through two different applications but you should never really access the same instrument at the same time with two different applications.
An
0 Kudos
Message 4 of 5
(4,172 Views)
Basically only one app should access the instrument. But in
some circumstances, two apps may need access at a time.
For instance, one app sets up the measurement mode, and
another app retrieve measurement data.

In this case the app1 posts setting cmd/query and/or retrieves
responses. And the app2 posts measurement cmd/query. Actual
scenario is like below:

app1:
Lock()
viWrite(vi, ":xxx:meas:mode yy")
viWrite(vi, ...)
viRead(vi, ...)
Unlock()

app2:
Lock()
viWrite(vi, ":xxx:meas:voltage?")
viRead(vi, ...)
Unlock()

Because app1 & app2 are in different processes, Windows critical section or
semaphore are not enough. Instead you need use a mutex. I don't know
if VISA lock/unlock are enough for this purpose.

makoto

"Kamran S." w
rote in message
news:506500000005000000755A0000-1011517314000@exchange.ni.com...
> That's a good point, you should be able to access the interface
> through two different applications but you should never really access
> the same instrument at the same time with two different applications.
0 Kudos
Message 5 of 5
(4,172 Views)