Go to Post it seems to have all the basic food groups: liquid, sugar, sauce, and robotics components. - ChrisMcK2186 [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 04-02-2012, 11:08
codalafin codalafin is offline
Registered User
FRC #1095
 
Join Date: Feb 2012
Location: Virginia
Posts: 4
codalafin is an unknown quantity at this point
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.
Reply With Quote
  #2   Spotlight this post!  
Unread 04-02-2012, 13:02
j.cole j.cole is offline
Registered User
FRC #0379
 
Join Date: Jan 2010
Location: Girard
Posts: 159
j.cole has much to be proud ofj.cole has much to be proud ofj.cole has much to be proud ofj.cole has much to be proud ofj.cole has much to be proud ofj.cole has much to be proud ofj.cole has much to be proud ofj.cole has much to be proud ofj.cole has much to be proud of
Re: Switch Latching

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
Attached Thumbnails
Click image for larger version

Name:	Capture.PNG
Views:	53
Size:	3.3 KB
ID:	11702  
__________________

It's not normally a good idea to give a programmer a drill but rules are made to be broken.

Last edited by j.cole : 04-02-2012 at 13:07.
Reply With Quote
  #3   Spotlight this post!  
Unread 04-02-2012, 13:26
codalafin codalafin is offline
Registered User
FRC #1095
 
Join Date: Feb 2012
Location: Virginia
Posts: 4
codalafin is an unknown quantity at this point
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.

Last edited by codalafin : 04-02-2012 at 13:32.
Reply With Quote
  #4   Spotlight this post!  
Unread 04-02-2012, 13:43
j.cole j.cole is offline
Registered User
FRC #0379
 
Join Date: Jan 2010
Location: Girard
Posts: 159
j.cole has much to be proud ofj.cole has much to be proud ofj.cole has much to be proud ofj.cole has much to be proud ofj.cole has much to be proud ofj.cole has much to be proud ofj.cole has much to be proud ofj.cole has much to be proud ofj.cole has much to be proud of
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.
__________________

It's not normally a good idea to give a programmer a drill but rules are made to be broken.
Reply With Quote
  #5   Spotlight this post!  
Unread 04-02-2012, 14:40
codalafin codalafin is offline
Registered User
FRC #1095
 
Join Date: Feb 2012
Location: Virginia
Posts: 4
codalafin is an unknown quantity at this point
Re: Switch Latching

I've tried multiple possible options, including storing a variable, but I can't figure out a way that works.
Reply With Quote
  #6   Spotlight this post!  
Unread 04-02-2012, 15:41
codalafin codalafin is offline
Registered User
FRC #1095
 
Join Date: Feb 2012
Location: Virginia
Posts: 4
codalafin is an unknown quantity at this point
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
Reply With Quote
  #7   Spotlight this post!  
Unread 04-02-2012, 18:45
DonRotolo's Avatar
DonRotolo DonRotolo is offline
Back to humble
FRC #0832
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Atlanta GA
Posts: 7,011
DonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond repute
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...
__________________

I am N2IRZ - What's your callsign?
Reply With Quote
  #8   Spotlight this post!  
Unread 04-02-2012, 20:48
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Switch Latching

Quote:
Originally Posted by codalafin View Post
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.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 22:28.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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