LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using a Local Variable on a button that has its mechanical actions set to latch when released

I have two loops running in parallel. In one loop I am controlling a VCR and in the other loop I am monitoring some environmental conditions. In my VCR Control I have buttons on the panel that operate the various functions and are setup as "Latch when released". In my monitoring loop I would like to activate the Rec and Stop buttons when certain conditions are meet. However when I create a local variable to these buttons an error occurs because of the latch. Is there a way to activate these without changing to a different latch.
0 Kudos
Message 1 of 5
(4,811 Views)
Terry,

I would suggest adding a (hidden) button for each, and using the appropriate action. Either that, or change the action on your buttons, and have the values reset (to mimic a latch when released) after the action is taken. This is done by resetting the value with a local after the appropriate action has been taken.

Hope this helps.

Michael Du'Lyea
Advanced Test Engineering
0 Kudos
Message 2 of 5
(4,811 Views)
Attached is a vi providing a more general solution to the problem. It's helpful when you have seperate processes that you need to be able to stop. To use this subVI, place it in each loop you wish to terminate. Wire the loop's "local stop" control to the "Continue?" input and the loop's run node to the "Keep Application Running" output.

Alsp put an instance in your initialization code somewhere with the "Initialization" input wired to a TRUE constant.

Now whenever any loop trips a stop, everybody stops...

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 3 of 5
(4,811 Views)
mikeporter wrote:

> Attached is a vi providing a more general solution to the problem.
> It's helpful when you have seperate processes that you need to be able

##### cut..

Hi Mike, hi Terry,
thats the way I handle it to. Maybes its helpful to put timing into the loop to prevent high cpu-usage. Second,
multible instances of this vi only work in this wanted way, because if theyre proberties are set to
nonreentrant. That means, the use the same memory space.

Lately I have written a vi with 2 instances of pid- controllers, which behaved very strangely. That was the
point where I stumbled over the reentrant stuff.
Because nonreentrant is default, and I never knew anything about reentrance before I just used my VIs...
Well the strangeness was, that the PID
VIs were accessed alternating and the internal results (shift registers)
of the previous used other PID-VI, were then used by the current accessed PID-VI. So there was no independance
between both PID instances, because the SHARED THE SAME MEMORY. If one is not aware of this circumstance, this
can be very confusing while debugging a VI. You see values changing of the strange behaving VI, and you don't
know why...

Thats it so far,

Rainer
0 Kudos
Message 5 of 5
(4,811 Views)
Yes, there is, but dealing with it can be strange. You can use references to set the buttons "on". A better way is to handle the latching of the buttons yourself. I have attached a VI that checks a number of buttons on screen, returns the name of a button that was pressed and turns off that button. You give the VI a reference to the VI that you are checking buttons on and an array of strings that contains the names (labels) of the buttons to check. This is a great VI for feeding user input into a case statement. Inside this VI you will also find VIs for setting and reading booleans (buttons).

This is the way that I would go. Since you are using references, you can even do all of this work in subVIs.

Rob
0 Kudos
Message 4 of 5
(4,811 Views)