LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA LOCK/UNLOCK

Hi,
I want to ask a visa(or gpib) lock/unlock question,for example:
 
Fun1()
{
visa_write(visession,command1);    
visa_read(response1);
}
Fun2()
{
visa_write(visession,command2);    
visa_read(response2);
}
 
Because Fun1 and Fun1 executed in different threading,How to guarantee there is no interrupt between
visa_write(visession,command1);    
visa_read(response1);
 
or
visa_write(visession,command2);    
visa_read(response2);
 
???
 
And if there is a way to LOCK/UNLOCK, if FUNC1 is LOCKED the VISA resource, How Func2 knows when the VISA resource is UNLOCKED?
 
Thanks for you attention.
==========================================
Using CVI 6.0 PDS on Win XP.
==========================================
0 Kudos
Message 1 of 4
(3,595 Views)

Hi,

   I aslo have some experience in using LabView,  and kown there are Visa lock and unlock functions, and there is a notify method to do this, but what these functions in CVI?

0 Kudos
Message 2 of 4
(3,593 Views)
I'm not familiar vith VISA functions, but you should be able to manage locks between threads by using locking functions included in the multithreading environment provided by CVI: CmtNewLock, CmtGetLock and CmtReleaseLock. These functions are described in the online help and in this document installed with CVI: <cvidir>\bin\multithreadingOverview.pdf


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 3 of 4
(3,579 Views)

Hello Roberto Bozzolo,

     Thanks for your reply.  The functions CmtNewLock, CmtGetLock and CmtReleaseLock are exactly what need. To combine use with viLock, viUnlock, It works perfectly.

  Thanks for NI LabWindows/CVI Discussion Forums again.

0 Kudos
Message 4 of 4
(3,568 Views)