Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Do I need to lock out the entire GPIB interface for each instrument?

I'm trying to "DLLize" my test engine by creating instrument DLLs, but I'm a bit lost on the GPIB interface.

I use 4 GPIB devices: a scope, a power supply, a DMM, and a function generator..

Previously, I've been using CmtGetLock and CmtReleaseLock to lock in one instrument at a time. (If I wanted to use the DMM, all access to the other instruments would be locked out until the entire DMM function finished.)

Is this even needed? Can I just lock the DMM out from other DMM calls, but leave the other instruments free to be called?
0 Kudos
Message 1 of 2
(3,347 Views)
I/O locking is normally required per instrument basis.  However, each I/O library function normally does this locking behind the scene. Therefore, while you are accessing a DMM, basically no need to lock out other instruments.  For example, the following operational sequence will work as you expect.
 
write DMM, "MEAS:VOLT?"
write POWER, "MEAS:CURR?"
read DMM --> acquire response
read POWER --> acquire response
 
For each call, the I/O library such as NI-488.2M or VISA will internally lock out the function call by using Win32 mutex objects.  This is why you don't have to lock between different instruments.
 
However, if two different programs or threads are accessing the same instrument at the same time, you must enclose entire access by lock.
 
[thread1]
lock
write DMM, "MEAS:VOLT?"
read DMM --> acquire response
unlock
 
[thread2]
lock
write DMM, "MEAS:CURR?"
read DMM --> acquire response
unlock
 
These two threads are safe to run at the same time, as long as lock/unlock are properly used. 

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

Message 2 of 2
(3,329 Views)