OCCRA
Go to Post I blame FIRST for being the best thing that has happened to me. - vivek16 [more]
Home
Go Back   Chief Delphi > Technical > National Instruments LabVIEW and Data Acquisition
CD-Events   CD-Media   CD-Spy   FRC-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 03-17-2012, 01:01 PM
beandip3160's Avatar
beandip3160 beandip3160 is offline
Registered User
FRC #3160
 
Join Date: Jan 2011
Location: grove, oklahoma
Posts: 54
beandip3160 is on a distinguished road
Limit Switches???

ok so I've used team 358s example on a toggle switch and it works great except what i want the toggle to do is run a motor until a limit switch is pressed, but if the toggle is hit again reverse the same motor, looking for a different limit switch and stop.

At first I thought that it was the limit switches, because for some reason labview is reading normally open switches as true, but in programming as the values were easy to reverse it still wasnt reading my limit switches.

What might be the reason?? Help!!!!!!!!!!!!!
Reply With Quote
  #2   Spotlight this post!  
Unread 03-17-2012, 01:47 PM
beandip3160's Avatar
beandip3160 beandip3160 is offline
Registered User
FRC #3160
 
Join Date: Jan 2011
Location: grove, oklahoma
Posts: 54
beandip3160 is on a distinguished road
Re: Limit Switches???

Ok so ive realized that the limit switches aren't being ignored the only problem is that they have to be held down and then the toggle must be activated again to stop the motor I'm so confused
Reply With Quote
  #3   Spotlight this post!  
Unread 03-17-2012, 01:51 PM
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 6,015
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: Limit Switches???



I assume you are using either a state machine or a parallel task to do this?

You'll probably get useful answers faster if you post your code.


See attachment. The boxes are states, the arrows are events which cause the state to change.

You might want to add additional events to allow the toggle switch to cycle through all the states.
Attached Thumbnails
Click image for larger version

Name:	state_machine.png
Views:	71
Size:	21.8 KB
ID:	12339  Click image for larger version

Name:	state_machine2.png
Views:	61
Size:	23.4 KB
ID:	12340  

Last edited by Ether : 03-17-2012 at 03:01 PM. Reason: added block diagram
Reply With Quote
  #4   Spotlight this post!  
Unread 11-12-2012, 04:51 PM
slijin's Avatar
slijin slijin is offline
Pockets
AKA: Samuel Lijin
FRC #0694 (StuyPulse)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2010
Location: New York City
Posts: 537
slijin is a splendid one to beholdslijin is a splendid one to beholdslijin is a splendid one to beholdslijin is a splendid one to beholdslijin is a splendid one to beholdslijin is a splendid one to beholdslijin is a splendid one to behold
Re: Limit Switches???

Quote:
Originally Posted by Ether View Post
You'll probably get useful answers faster if you post your code.
Describing your setup as well would probably help.

In pseudocode, it would be something like:

Code:
direction = forward
toggle_prev = false


loop:
   if report_state(limit_switch_1):
      stop(motor)
      direction = backward

   if report_state(limit_switch_2):
      stop(motor)
      direction = forward

   if report_state(toggle) != toggle_prev:
      if report_state(limit_switch_1) or report_state(limit_switch_2):
         set(motor, direction)
         ## Keep in mind this will only work if set() is a state function
         ## (that is, if set() doesn't have to be looped to keep the motor running())
      elif report_state(motor) == running:
         stop(motor)
      toggle_prev = report_state(toggle)
   
   delay 100
The last delay statement is crucial. Here's why: You start from the center, hit the toggle to move forward, hit a limit switch, stopping the motor Then you hit the toggle again to run it backwards, but if the loop runs fast enough, the limit switch will still be triggered, stopping the motor again and reversing the direction. As a result, you'll be left oscillating at that limit switch. The delay lets the motor run long enough so that the limit switch doesn't stay triggered when the loop repeats.
__________________

2010-12 CT Chairman's
2011 Galileo 5th seed
2010 NY Regional Winners
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 07:06 AM.

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


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