LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Quick question about latching boolean and event structures

Solved!
Go to solution

Hey, for some reason my latched boolean controls are not resetting when using an event structure. 

I have put the booleans controls in their respective events, and even tried using flat sequence structures to ensure the VI reads them. 

What is a reason this could be happening? Can't post the code just at the moment. 

0 Kudos
Message 1 of 23
(5,888 Views)

Are you sure the event case is being called?  Are you sure the control is set to Latch?

 

Those are the only reasons it would not unlatch when the terminal is in the Value Change event case.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 23
(5,873 Views)

If you have a Latch Until Released button tied to a while loop condition terminal that exits the program, the button likely won't unlatch before the program exits.

Capture.PNG

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
Message 3 of 23
(5,838 Views)

@aputman wrote:

If you have a Latch Until Released button tied to a while loop condition terminal that exits the program, the button likely won't unlatch before the program exits.

Capture.PNG


Why do you say that?  My experience, the button unlatches as soon as it is read, which is going to occur before the event structure exits and then the while loop.

Message 4 of 23
(5,834 Views)

@RavensFan wrote:

@aputman wrote:

If you have a Latch Until Released button tied to a while loop condition terminal that exits the program, the button likely won't unlatch before the program exits.

Capture.PNG


Why do you say that?  My experience, the button unlatches as soon as it is read, which is going to occur before the event structure exits and then the while loop.


Because it doesn't unlatch.  Try it.  I guess if you can click and release the mouse fast enough before the program exits, it would unlatch.  But I can't run the above code and get the button to unlatch before exiting.  

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 5 of 23
(5,830 Views)

It works just fine for me.

 

Here is a version saved in LV2014.  (I originally created it in LV16 and it worked fine there also.)

 

I also tried making it Latch When Pressed to see if that changed anything.  It still unlatched.

0 Kudos
Message 6 of 23
(5,825 Views)

I'm still on 2012 so I can't open your file.  Latch When Pressed and Latch When Released work fine.  If you look at the visual explanation of Latch Until Released, the mouse goes down, the button value is changed, the control is read and at this point the event structure is complete and the program can exit but the mouse button hasn't be released and so the control can't reset. Has something changed since 2012 in this regard?

Untitled.png

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 7 of 23
(5,820 Views)

This is what happens when no code is posted to explain the problem.  LOL Smiley Very Happy

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 8 of 23
(5,815 Views)

I'm sorry.  You're right.  Having code sure would've helped.  The original poster never really did say which version of Latched he was using.

 

Your posts did say "Latch Until Released" and I kept thinking "Latch When Released".  Why, I have never found a valid reason to ever use Latch Until Released and don't know why anyone would.

 

If I would rank the order of how often I used the different actions.

 

1 or 2  Latch When Released  (bottom center)

1 or 2  Switch When Released (top center)  both of these behave with normal Windows button action of allowing you to drag off before releasing in case you made a mistake.

 

3  Switch Until Relased (top right)  used this a few times for "jog" buttons,  act on when pushed in, stop immediately upon release.  Usually use in conjection with an event structure.

 

4 or 5  Latch When Pressed  (bottom left)

4 or 5  Switch When Pressed (top left)  only use if I need an instantaneous action upon the press

 

6  Latch Until Released (bottom right)  Never, ever, ever used it.  No idea why I would.

 

But you're right, Latch Until Released does not pop up because the VI probably stops running before you let go.  And a non-running VI has no latching and unlatching actions with it.

 

To the original poster, if you are using Latch Until Release, just don't.  If you think you do, please tell us why.  I would bet you are using the wrong action and really want Latch When Released.

 

0 Kudos
Message 9 of 23
(5,803 Views)

@nishalc wrote:

Hey, for some reason my latched boolean controls are not resetting when using an event structure. 

I have put the booleans controls in their respective events, and even tried using flat sequence structures to ensure the VI reads them. 


We cannot debug vague sentences.

 

As mentioned, we don't even know if the event executes. You also did not say what kind of event is assigned to the latched boolean (value changed, mouse down, etc.).

 

I don't understand your "use flat sequences" logic. Sequences don't ensure anything except execution order.

0 Kudos
Message 10 of 23
(5,786 Views)