Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

why does visa exclusive lock always timeout?

I am controlling a signal generator with Labview via a GPIB interface.  The front panel has a button that the user may push to toggle the output of the the gerenerator on or off.  The problem I encountered was that if the user changes the state quickly ( about the speed of a typical double click on the mouse) then the vi would lockup.  My solution was to use the asynchronous lock function after opening the visa session to toggle the generator state.  This worked initially.  As I applied this to the other controls the original problem came back.  Now, when I try to create an exclusive lock, the asynchronous lock function returns a timeout error message.  I also tried omitting the asynchronous lock function and just setting the acces mode to 1 on the VISA open: again, the same timeout error. 

Any thoughts on how to restore the exclusive lock feature for open visa sessions?

Is there a better way to ensure that the user cannot lock up the application by sending commands to the device too quickly?

Thanks.

--Dave

0 Kudos
Message 1 of 2
(3,236 Views)

Hi Dave,

How is your code designed?  How are you using the VISA lock to lock access to a VISA resource?  Would it be pausible to post a small piece of code that illustrates the problem you are experiencing? The last timeout you mention, can you tell me what is throwing that timeout error?

One alternative to using VISA lock functions, is use property nodes for the front panel controls.  You could use a simple case structure (or event structure) to disable a front panel control programmatically, and then re-enable the control when you see fit in your code.  I've attached a really simple piece of code that disables a control after it has be clicked.

I hope this helps, post back with any questions.  Thanks!

Ted

Ted H
Applications Engineering
National Instruments
0 Kudos
Message 2 of 2
(3,212 Views)