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 が編集しています。