Jump to content
Sign in to follow this  
Steve Weidman

Latch Button Output

Recommended Posts

I'm still very new to LabView and need some help.

I would like to capture the output of a button and latch it until I reset it. Is there any kind of a latch function that can capture and hold boolean values until I reset it?

Thanks,

-Steve

Share this post


Link to post
Share on other sites

QUOTE(Steve Weidman @ Mar 6 2007, 12:33 PM)

I would like to capture the output of a button and latch it until I reset it. Is there any kind of a latch function that can capture and hold boolean values until I reset it?

This latching behavior is found in the "Mechanical Action" submenu that is available upon right-clicking on the boolean. The correct behavior depends on how you want to reset it. If you want to reset it programmatically, then you would choose either "Switch When Pressed" or "Switch When Released". This would change the boolean state and leave it in the new state. Then you would change it back in your code.

If you want to have the boolean change as soon as you press it, and then 'reset' when you let go, then choose "Switch Until Released". I hope that helps. If you are talking purely holding or latching a value in your code, then look into shift registers.

David

Share this post


Link to post
Share on other sites

look at the mechanical action of a boolean (right click)

maybe you do not need the latch but the switch action so you can use local vars to reset that one.

The latch action will reset when read by the program

QUOTE(Steve Weidman @ Mar 6 2007, 03:33 PM)

I'm still very new to LabView and need some help.

I would like to capture the output of a button and latch it until I reset it. Is there any kind of a latch function that can capture and hold boolean values until I reset it?

Thanks,

-Steve

Share this post


Link to post
Share on other sites

QUOTE(dsaunders @ Mar 6 2007, 03:46 PM)

This latching behavior is found in the "Mechanical Action" submenu that is available upon right-clicking on the boolean. The correct behavior depends on how you want to reset it. If you want to reset it programmatically, then you would choose either "Switch When Pressed" or "Switch When Released". This would change the boolean state and leave it in the new state. Then you would change it back in your code.

If you want to have the boolean change as soon as you press it, and then 'reset' when you let go, then choose "Switch Until Released". I hope that helps. If you are talking purely holding or latching a value in your code, then look into shift registers.

David

Thanks for the input. I knew about the button's actual latching function. Unfortunately, this is not going to accptable since it goes away once LabView reads the switch. Now in regards to a shift register, do any of you have examples of a scheme that will allow me to "capture" the fact that a button was pushed and use it in the rest of the VI until I'm ready to discard it?

Thanks,

-Steve

Share this post


Link to post
Share on other sites

QUOTE(Steve Weidman @ Mar 7 2007, 05:37 AM)

Thanks for the input. I knew about the button's actual latching function. Unfortunately, this is not going to accptable since it goes away once LabView reads the switch.

Judging by this statement it seems that you are using the "Latch When Pressed" or "Latch When Released" action. These actions cause the boolean to revert back to false after LabVIEW reads the boolean in the program. If you use the "Switch" actions, then the boolean stays true even after LabVIEW reads the switch.

David

Share this post


Link to post
Share on other sites

QUOTE(dsaunders @ Mar 7 2007, 12:42 PM)

Judging by this statement it seems that you are using the "Latch When Pressed" or "Latch When Released" action. These actions cause the boolean to revert back to false after LabVIEW reads the boolean in the program. If you use the "Switch" actions, then the boolean stays true even after LabVIEW reads the switch.

David

I thought about using the switches instead of the push buttons, but I really need it to do both. I have a case structure that needs to operate once, and I also have a routine that needs to run for an extended time (ie my need for the latch).

Also, I need the latch to show a condition. I have an In Range and Coerce function that if a signal ever drops too low or goes too high, the In Range function's output needs to be latched for the entire time of my test. It will not be reset until the beginning of the next test (which is started by a push button).

I'm open to any ideas...

Thanks,

-Steve

Share this post


Link to post
Share on other sites

Hi Steve:

I think Albert may have been on the right path when he suggested local variables. Have the button switch and stay switched as long as you need it held that way (Latch when released action). After you complete the last action that needs the button switched, then write a false value to a local variable for the switch. (BTW, you can't make local variables for switches or buttons which have momentary action-- So set the mode to Latch when [pressed or released] before you try to make the local variable.

Of course, might be an even better way-- best to avoid local variables unless really necessary-- if you can share your VI we might be able to suggest something more elegant.

Best Regards, Louis.

Share this post


Link to post
Share on other sites

QUOTE(Michael_Aivaliotis @ Mar 8 2007, 01:42 AM)

Thanks so much for the VI. That makes pretty good sense. I can see how that will be able to latch the outputs from the min/max test.

Now, what I also need to do is capture the output from a push button. I need the push button to do a user dialog for entering a serial number and to also start a test. Right now, I can capture the serial number fine by using a momentary push button that triggers a case structure with the dialog in the true portion of it. But what I also need to do is capture the fact that the push button has started my test running. This is going to be really simple to put into what I already have if I can "capture" or latch the fact that the push button has been pressed. I want to latch that so that additonal clicks to the push button don't do anything until the test has been completed. Did that make sense at all?

Thanks,

-Steve

Share this post


Link to post
Share on other sites

QUOTE(Steve Weidman @ Mar 8 2007, 10:29 AM)

Thanks so much for the VI. That makes pretty good sense. I can see how that will be able to latch the outputs from the min/max test.

Now, what I also need to do is capture the output from a push button. I need the push button to do a user dialog for entering a serial number and to also start a test. Right now, I can capture the serial number fine by using a momentary push button that triggers a case structure with the dialog in the true portion of it. But what I also need to do is capture the fact that the push button has started my test running. This is going to be really simple to put into what I already have if I can "capture" or latch the fact that the push button has been pressed. I want to latch that so that additonal clicks to the push button don't do anything until the test has been completed. Did that make sense at all?

Thanks,

-Steve

Also, how do I make this into a sub-VI? Every time I nest While Loops, the outer loop seems to stop running.

Thanks,

-Steve

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.