Go to Post Do not worry about the VEX camp versus FIRST camp issues. It is a huge marketplace. It is only about 4% penetrated. There is room for everyone. And competition is good for the consumer. - ebarker [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 02-04-2012, 13:18
dokusou's Avatar
dokusou dokusou is offline
Registered User
FRC #3272
 
Join Date: Feb 2012
Location: Carrollton
Posts: 20
dokusou is an unknown quantity at this point
Toggle switch problems

I've been working with lab view for maybe a year now and I've been talking with a programmer for a couple of months trying to get a toggle switch to work. I have what I believe is correct for the programming wiring in labview. I've set up a ref num in begin .vi and set up a back ref to begin .vi in a new vi I made. But yet when I deploy it I can't control the motor.
Reply With Quote
  #2   Spotlight this post!  
Unread 02-04-2012, 13:28
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,100
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Toggle switch problems

Quote:
Originally Posted by dokusou View Post
I've been working with lab view for maybe a year now and I've been talking with a programmer for a couple of months trying to get a toggle switch to work. I have what I believe is correct for the programming wiring in labview. I've set up a ref num in begin .vi and set up a back ref to begin .vi in a new vi I made. But yet when I deploy it I can't control the motor.
Post your code.


Reply With Quote
  #3   Spotlight this post!  
Unread 02-04-2012, 14:39
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: Toggle switch problems

What do you mean by a "toggle switch"? I can think of at least three things you might be referring to, and they're all completely different.

What do you want to do with the switch? Be as specific as you can.
Reply With Quote
  #4   Spotlight this post!  
Unread 02-04-2012, 19:46
dokusou's Avatar
dokusou dokusou is offline
Registered User
FRC #3272
 
Join Date: Feb 2012
Location: Carrollton
Posts: 20
dokusou is an unknown quantity at this point
Re: Toggle switch problems

By a toggle switch I mean you press a button on a joystick once and the motor turns on. You press the same button again and it turns off.
Reply With Quote
  #5   Spotlight this post!  
Unread 02-04-2012, 19:49
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,100
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Toggle switch problems

Quote:
Originally Posted by dokusou View Post
By a toggle switch I mean you press a button on a joystick once and the motor turns on. You press the same button again and it turns off.
http://www.chiefdelphi.com/forums/sh...09&postcount=2


Reply With Quote
  #6   Spotlight this post!  
Unread 02-04-2012, 23:21
lorem3k's Avatar
lorem3k lorem3k is offline
1 + 1 = 0 (in Z/2Z)
AKA: Andy D.
FRC #1482 (Bishop Grandin Ghosts)
Team Role: Alumni
 
Join Date: Apr 2012
Rookie Year: 2011
Location: Calgary, AB
Posts: 165
lorem3k is a splendid one to beholdlorem3k is a splendid one to beholdlorem3k is a splendid one to beholdlorem3k is a splendid one to beholdlorem3k is a splendid one to beholdlorem3k is a splendid one to behold
Re: Toggle switch problems

If you set it up like this, you can make it a SubVI with an input and output instead. This is useful if you want to have multiple toggles in your code, so that your Teleop.vi doesn't get as cluttered.
http://i.imgur.com/GVxbv.png
__________________
Boo! Bishop Grandin High School / GM Canada / Tenaris
2013 Western Canada - Quarterfinalists (thanks 288/4719) / 2012 GTR West - Quarterfinalists (thanks 188/1075) / 2011 GTR East - Regional Winners (thanks 1114/1503)

Last edited by lorem3k : 02-04-2012 at 23:24. Reason: changed page-stretching image to url
Reply With Quote
  #7   Spotlight this post!  
Unread 03-04-2012, 00:13
dokusou's Avatar
dokusou dokusou is offline
Registered User
FRC #3272
 
Join Date: Feb 2012
Location: Carrollton
Posts: 20
dokusou is an unknown quantity at this point
Re: Toggle switch problems

Oh wow. ok this is so much more complicated then I've been told. I've been told by someone on FIRST forums that it was a lot simpler. http://forums.usfirst.org/showthread...8107#post58107
That was the forum with everything I've been using, and what you posted there is so much different then what I've seen. :/
Reply With Quote
  #8   Spotlight this post!  
Unread 03-04-2012, 06:54
tilky's Avatar
tilky tilky is offline
Registered User
AKA: Ryan Thielke
FRC #3137
Team Role: Programmer
 
Join Date: Nov 2011
Rookie Year: 2011
Location: Connetquot
Posts: 188
tilky is an unknown quantity at this point
Re: Toggle switch problems

a much easier way would be to have a local/global variable , and when you click a joystick button, in a case structure read the value, wire it to a not, and write the value to the variable. It is a lot less confusing then the previous posts and just as effective
Reply With Quote
  #9   Spotlight this post!  
Unread 03-04-2012, 07:43
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Toggle switch problems

Actually, the previous post is the more professional way of doing it. Globals and locals, in almost any language, are the least common denominator and often not the best approach. Next time you write a simple expression that has localized state data, try using a shift register. Next time you have an expression needed in multiple places, try using a subVI.

Greg McKaskle
Reply With Quote
  #10   Spotlight this post!  
Unread 03-04-2012, 10:12
tr6scott's Avatar
tr6scott tr6scott is offline
Um, I smell Motor!
AKA: Scott McBride
FRC #2137 (TORC)
Team Role: Mentor
 
Join Date: Dec 2007
Rookie Year: 2005
Location: Oxford, MI
Posts: 524
tr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond repute
Re: Toggle switch problems

Here are a couple subvi's we have made to help with these issues.

TON.vi is "Timer On delay" takes a Boolean input and delays TRUE in milli-seconds.
TOF.vi is "Timer Off delay" takes a Boolean input and delays the on to off transition by milliseconds.
TOF_Toggle.vi takes a Boolean input, TOF's signal and then toggles output state.

In PLC code, TOF is used to de-bounce signals, limit switches. Many game controllers will double trip when pressed or released, using the TOF will mask those events. We typically use 100 ms for the delays for joystick buttons.

All of these do not stall code with waits, it will take a snapshot of current time and set the future time to look for the delay, and are re-entrant mode, so many in the vi will not conflict with each other.
Attached Files
File Type: zip TORC Sub VIs.zip (26.0 KB, 20 views)
__________________
The sooner we get behind schedule, the more time we have to catch up.

Reply With Quote
  #11   Spotlight this post!  
Unread 03-04-2012, 14:20
dokusou's Avatar
dokusou dokusou is offline
Registered User
FRC #3272
 
Join Date: Feb 2012
Location: Carrollton
Posts: 20
dokusou is an unknown quantity at this point
Re: Toggle switch problems

lorem3k, in the code you sent me the node right after your button 1 unbundle value what would that be and where would i find it? Anyone can answer if need be.
Reply With Quote
  #12   Spotlight this post!  
Unread 03-04-2012, 18:30
lorem3k's Avatar
lorem3k lorem3k is offline
1 + 1 = 0 (in Z/2Z)
AKA: Andy D.
FRC #1482 (Bishop Grandin Ghosts)
Team Role: Alumni
 
Join Date: Apr 2012
Rookie Year: 2011
Location: Calgary, AB
Posts: 165
lorem3k is a splendid one to beholdlorem3k is a splendid one to beholdlorem3k is a splendid one to beholdlorem3k is a splendid one to beholdlorem3k is a splendid one to beholdlorem3k is a splendid one to behold
Re: Toggle switch problems

Quote:
Originally Posted by dokusou View Post
lorem3k, in the code you sent me the node right after your button 1 unbundle value what would that be and where would i find it? Anyone can answer if need be.
The node with Button 1 going into it is just a SubVi with the code shown above inside. Also, the 4 different images above are the different states of the case structures, you don't need to put it into the VI 4 times. Sorry for any confusion.
__________________
Boo! Bishop Grandin High School / GM Canada / Tenaris
2013 Western Canada - Quarterfinalists (thanks 288/4719) / 2012 GTR West - Quarterfinalists (thanks 188/1075) / 2011 GTR East - Regional Winners (thanks 1114/1503)
Reply With Quote
  #13   Spotlight this post!  
Unread 04-04-2012, 10:45
dokusou's Avatar
dokusou dokusou is offline
Registered User
FRC #3272
 
Join Date: Feb 2012
Location: Carrollton
Posts: 20
dokusou is an unknown quantity at this point
Re: Toggle switch problems

The input and output for the subvi. You connect it to the greater than node. their green, where would i find these??
Reply With Quote
  #14   Spotlight this post!  
Unread 04-04-2012, 19:18
lorem3k's Avatar
lorem3k lorem3k is offline
1 + 1 = 0 (in Z/2Z)
AKA: Andy D.
FRC #1482 (Bishop Grandin Ghosts)
Team Role: Alumni
 
Join Date: Apr 2012
Rookie Year: 2011
Location: Calgary, AB
Posts: 165
lorem3k is a splendid one to beholdlorem3k is a splendid one to beholdlorem3k is a splendid one to beholdlorem3k is a splendid one to beholdlorem3k is a splendid one to beholdlorem3k is a splendid one to behold
Re: Toggle switch problems

Quote:
Originally Posted by dokusou View Post
The input and output for the subvi. You connect it to the greater than node. their green, where would i find these??
Right-click on one of the greater than's terminals and choose Create -> Control. Right-click on one of the constants inside the second case structure (doesn't matter which) and choose Create -> Indicator. To wire them to have an input and output as a SubVI node, open the front panel of the VI, right-click the icon near the top-right, and choose Patterns -> the one that's just a square with one vertical line dividing it in half. Click and hold on the left one, drag the mouse to the input button on the front panel, and then click it; and then repeat with the right half and the output indicator. Now the node will have an input and output in Teleop.vi (or wherever you choose to put it), and you simply wire the button to the input side, and the output to whatever case structure you want to control.
__________________
Boo! Bishop Grandin High School / GM Canada / Tenaris
2013 Western Canada - Quarterfinalists (thanks 288/4719) / 2012 GTR West - Quarterfinalists (thanks 188/1075) / 2011 GTR East - Regional Winners (thanks 1114/1503)
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 21:46.

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