Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use AcquireInterfaceLock and ReleaseInterfaceLock?

I want to write 2 applications written in C# using the same GPIB card.
The two applications are running a sequence talking with GPIB instruments.
It is possible that the two applications are communicating with the same GPIB instruments.
I have tried to use AcquireInterfaceLock and ReleaseInterfaceLock to lock the GPIB board during execution of GPIB calls, but I have troubles with the synchronization of the two applications.
Is it possible to get a sample how to use AcquireInterfaceLock and ReleaseInterfaceLock?
0 Kudos
Message 1 of 2
(2,837 Views)
Hi,

There is no example in C that I can provide you but the basic principle is not that difficult.

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()

I've tried this once in LabVIEW with the iblock and ibunlock functions and they applications work fine.

Regards.

JV
0 Kudos
Message 2 of 2
(2,816 Views)