Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   Switch Latching (http://www.chiefdelphi.com/forums/showthread.php?t=101928)

codalafin 04-02-2012 11:08

Switch Latching
 
I want to use a physical switch to act how a boolean control does. Specifically I need the ability to use "latch when released", activating a case structure when the switch goes from True to False. I have no idea where to begin with doing this, but I've opened the digital input, set the channel it runs on, set it under a variable name, and gotten its true-false value. Where do I work from there?
Also, if the answer would be in LabView help, I'm sorry but for some stupid reason the help doesn't load on this computer. I waited 15 minutes for the "Boolean Controls" page to load hoping that might have an answer and it never did.

j.cole 04-02-2012 13:02

Re: Switch Latching
 
1 Attachment(s)
The way I do it is to use a global variable.

I Use a case structure that is asking for the boolean and every time it turns true the value of the boolean is inverted.

Now in the picture I have it in teleoperated which causes some problems because you can't instantly press and release the button. So it cycles through true and false very quickly and I recommend some way of knowing the value.

Follow the Button Toggle Action example HERE

codalafin 04-02-2012 13:26

Re: Switch Latching
 
I don't think a toggle button will solve my issue. That would save the state until I pressed it again, which is most certainly not what I want.
Pretty much, in waveform description, I want the case structure to activate when the digital wave goes from 1 to 0.
I also can't use what that picture shows, since the variable will keep changing every moment the switch is pressed.

j.cole 04-02-2012 13:43

Re: Switch Latching
 
Okay I see what you want now. You want the action to only change when it goes from 1 to 0 and not when it goes from 0 to 1.

codalafin 04-02-2012 14:40

Re: Switch Latching
 
I've tried multiple possible options, including storing a variable, but I can't figure out a way that works.

codalafin 04-02-2012 15:41

Re: Switch Latching
 
Okay so I may have found what I need, can't test it at the moment but http://team358.org/files/programming...tonRelease.jpg that node + less than system should work fine. genius design

DonRotolo 04-02-2012 18:45

Re: Switch Latching
 
Maybe this is solved, but what if you stop checking the condition of the switch after it has activated the first time?

Pseudocode:

If SwitchedOn is ON, jump to move_along
.Check switch
.If switch is 1, set SwitchedOn to ON
move_along
...the rest of the code...

Alan Anderson 04-02-2012 20:48

Re: Switch Latching
 
Quote:

Originally Posted by codalafin (Post 1119890)
Okay so I may have found what I need, can't test it at the moment but http://team358.org/files/programming...tonRelease.jpg that node + less than system should work fine. genius design

That's exactly what you want. I've made teeny little SubVIs that just take a boolean input and do the feedback node/comparison step, calling them "RisingEdge" and "FallingEdge". Their icons are very small.


All times are GMT -5. The time now is 11:41.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi