09-18-2014 04:12 AM
Hello,
i have 50 instruments that are controlled in two threads running at the same time.
Thread 1: Only VISA write (configuration of the instruments)
Thread 2: Visa write and Visa read (read measurement from instrument)
Can i now simply add the "Visa Lock Async VI" before the write and "Visa Unlock" at the end?
Thread 1: Visa Lock -> Write -> Visa Unlock
Thread 2: Visa Lock -> Write -> Read -> Visa Unlock
Thanks
09-18-2014 06:16 AM
It is really best if you can put all of the instrument control into a single thread. That way you don't have to play these lock-do something-unlock games. A Queued Message Handler works wonderfully for this situation. But if you insist on not doing that (I know there are situations where you can't), then a Semaphore is really the way to go.
09-18-2014 06:57 AM
Thanks for the help.
But it is also working with the Visa lock/unlock?
Using sempahores makes it very unreadable as i have to create new input/outputs to all VIs for the semaphores.
And the Visa addresses are already available for lock/unlock.
09-19-2014 01:50 AM
Hello OnlyOne,
yes this should work.
What you can also try is to set read and write to synchronous mode
Choosing between Synchronous and Asynchronous VISA Functions
Hope this helps a little bit.