Go to Post A FIRST door is always open. - Chris Fultz [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #16   Spotlight this post!  
Unread 15-02-2010, 06:38
gokul gokul is offline
Registered User
FRC #0571
 
Join Date: Jan 2006
Location: CT
Posts: 25
gokul is an unknown quantity at this point
Re: Limit Switch Draws Tears

Focusing on the limit switch problem:

1. It should be referred to as DigitalInput (1) or DigitalInput (4,1) - nothing else.
The first number refers to the slot where your digital module is - in this case Slot 4.

2. Make sure your switch itself is a normally Open type switch
Switches come as Normally Open and Normally Closed - closed will always show one unless it is operated in a different way.
You can check this using a multimeter.
  #17   Spotlight this post!  
Unread 15-02-2010, 07:49
Unsung FIRST Hero
Mike Betts Mike Betts is offline
Electrical Engineer
no team
Team Role: Engineer
 
Join Date: Dec 2001
Rookie Year: 1995
Location: Homosassa, FL
Posts: 1,442
Mike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond repute
Re: Limit Switch Draws Tears

Quote:
Originally Posted by gokul View Post
...Make sure your switch itself is a normally Open type switch Switches come as Normally Open and Normally Closed - closed will always show one unless it is operated in a different way...
Not true. "Normally" only reflects the position of the contacts when the switch is not pressed. A NO switch will close when pressed, a NC switch will open.

There are many times when you want a NC switch. This is particularly true of limit switches. If a wire breaks and the switch is no longer "in the circuit" you want the motor or actuator that you are limiting to stop. This is usually much safer...

Regards,

Mike
__________________
Mike Betts

Alumnus, Team 3518, Panthrobots, 2011
Alumnus, Team 177, Bobcat Robotics, 1995 - 2010
LRI, Connecticut Regional, 2007-2010
LRI, WPI Regional, 2009 - 2010
RI, South Florida Regional, 2012 - 2013

As easy as 355/113...
  #18   Spotlight this post!  
Unread 15-02-2010, 08:16
z2daj z2daj is offline
Registered User
FRC #2836 (Team Beta)
Team Role: Programmer
 
Join Date: Feb 2009
Rookie Year: 2009
Location: Bethlehem, CT
Posts: 15
z2daj is an unknown quantity at this point
Send a message via AIM to z2daj
Re: Limit Switch Draws Tears

Yes yes yes, we understand the dynamics of how a switch works

The third condition was just an act of desperation, seeing if anything would work.

The switch itself is perfect. It is wired up correctly and everything as previously stated. I believe where our problem lies is within the coding. I think it is declared properly, yet the switch refuses to recognize a closed position.

I blame Fate.
__________________
There is nothing to fear, but fear itself
  #19   Spotlight this post!  
Unread 15-02-2010, 08:50
Unsung FIRST Hero
Mike Betts Mike Betts is offline
Electrical Engineer
no team
Team Role: Engineer
 
Join Date: Dec 2001
Rookie Year: 1995
Location: Homosassa, FL
Posts: 1,442
Mike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond repute
Re: Limit Switch Draws Tears

Quote:
Originally Posted by z2daj View Post
Yes yes yes, we understand the dynamics of how a switch works

The third condition was just an act of desperation, seeing if anything would work.

The switch itself is perfect. It is wired up correctly and everything as previously stated. I believe where our problem lies is within the coding. I think it is declared properly, yet the switch refuses to recognize a closed position.

I blame Fate.
So what you are saying is that you knowingly posted code here which you knew could not work and want us to divine why the code that you did not show us (the code that should work) does not work...

How do you expect anyone to help you?

Mike
__________________
Mike Betts

Alumnus, Team 3518, Panthrobots, 2011
Alumnus, Team 177, Bobcat Robotics, 1995 - 2010
LRI, Connecticut Regional, 2007-2010
LRI, WPI Regional, 2009 - 2010
RI, South Florida Regional, 2012 - 2013

As easy as 355/113...
  #20   Spotlight this post!  
Unread 15-02-2010, 08:54
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: Limit Switch Draws Tears

Quote:
Originally Posted by z2daj View Post
I believe where our problem lies is within the coding.
It is abundantly clear that the code is broken, as has been pointed out to you by multiple people. Please please please please read the responses telling you exactly what line is totally wrong (hint: it's the one saying DigitalInput(1,1), and should be changed to DigitalInput(4), assuming your limit switch is on DIO 4 of a Digital Sidecar connected to the module in slot 4).

Quote:
I blame Fate.
If you regularly ignore the advice of people trying to help you, the blame quickly shifts.
  #21   Spotlight this post!  
Unread 15-02-2010, 09:23
Mr. Lim Mr. Lim is offline
Registered User
AKA: Mr. Lim
no team
Team Role: Leadership
 
Join Date: Jan 2004
Rookie Year: 1998
Location: Toronto, Ontario
Posts: 1,125
Mr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond repute
Re: Limit Switch Draws Tears

Make sure your limit switch is wired up between the Signal and Ground wires (and NOT Signal and Power). Signal and Ground are the only two wires you need for a simple limit switch.

Double check with a meter with the switch connected and robot powered on that the voltage across the switch changes from 0 to 5V.

I know this might be something you have already done, however I've run into many teams that try and wire the Power and Signal wires to the switch, and verify that the "switch works" by just checking whether the resistance across the switch goes to 0
__________________
In life, what you give, you keep. What you fail to give, you lose forever...
  #22   Spotlight this post!  
Unread 15-02-2010, 09:33
z2daj z2daj is offline
Registered User
FRC #2836 (Team Beta)
Team Role: Programmer
 
Join Date: Feb 2009
Rookie Year: 2009
Location: Bethlehem, CT
Posts: 15
z2daj is an unknown quantity at this point
Send a message via AIM to z2daj
Re: Limit Switch Draws Tears

Now here is where things get interesting. We have read and tried all of the above solutions AND the reason why we posted the code was so that you could better understand our situtation. Just because we had 3 conditions for a boolean operation does not constitute snotty remarks. It is very eaasy to ignore the third condition as that is not our main problem. I think it is you that must read our responses to the solutions posted. Thank you Mr. Lim and those of you who posted solutions, we have tried all of them , but failure seems too proud to leave us this day.
__________________
There is nothing to fear, but fear itself
  #23   Spotlight this post!  
Unread 15-02-2010, 10:03
Unsung FIRST Hero
Mike Betts Mike Betts is offline
Electrical Engineer
no team
Team Role: Engineer
 
Join Date: Dec 2001
Rookie Year: 1995
Location: Homosassa, FL
Posts: 1,442
Mike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond repute
Re: Limit Switch Draws Tears

Quote:
Originally Posted by z2daj View Post
Now here is where things get interesting. We have read and tried all of the above solutions AND the reason why we posted the code was so that you could better understand our situtation. Just because we had 3 conditions for a boolean operation does not constitute snotty remarks. It is very eaasy to ignore the third condition as that is not our main problem. I think it is you that must read our responses to the solutions posted. Thank you Mr. Lim and those of you who posted solutions, we have tried all of them , but failure seems too proud to leave us this day.
This will be my last post on this thread.

You originally said that you had two limit switches wired to DI 4 on the digital sidecar.

You then posted a code fragment with this:

Dig1 = new DigitalInput(1, 1);

which is an example of code that can not possible work. Why? The Analog I/O module must be in slot #1.

I replied that the code fragment should have been

Dig1 = new DigitalInput(4, 4);

assuming the digital I/O module is plugged into slot 4 of the cRIO.

You then replied that you had "tried all of the possible solutions" and I asked you to tell us exactly how the switches are wired.

You did not.

The discussion of three conditions came about because you asked. I merely said that you had more than one issue... I also asked you to tell us what you were trying to accomplish. You did not.

The discussion of normally open versus normally closed was especially pertinent as we still do not know how the TWO switches are wired.

Since you will not tell us how things are wired we have to guess... Two normally open switches, wired in series and operated one at a time will never close a circuit and always return a 1 in your code... This is an example of why limit switches are almost always wired as normally closed.

You were asked to explain your wiring. You did not...
You posted code which could not work and you knew that it could not work because you are addressing the analog module...

And somehow you infer that we are to blame because we can not read your mind...

I am done here...

Good luck

Mike
__________________
Mike Betts

Alumnus, Team 3518, Panthrobots, 2011
Alumnus, Team 177, Bobcat Robotics, 1995 - 2010
LRI, Connecticut Regional, 2007-2010
LRI, WPI Regional, 2009 - 2010
RI, South Florida Regional, 2012 - 2013

As easy as 355/113...
  #24   Spotlight this post!  
Unread 15-02-2010, 10:17
Mr. Lim Mr. Lim is offline
Registered User
AKA: Mr. Lim
no team
Team Role: Leadership
 
Join Date: Jan 2004
Rookie Year: 1998
Location: Toronto, Ontario
Posts: 1,125
Mr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond repute
Re: Limit Switch Draws Tears

z2daj,

You need to understand that the CD community consists of VERY good mentors who pretty much could solve your problem in a matter of seconds if they were there and able to collect the information they need. What you perceive as a snotty remark is probably a bit a frustration on our part by the inability to get the information we need.

It's a limit switch, and we want to get you up and running ASAP.

Can you answer these questions for us?

1. Does your switch, when hooked up with the robot powered on, measure 5V and then change to 0V across the terminals when you press and release your switch?

2. Where exactly is your switch hooked up on the digital side car? Digital I/O 4? Not relays, or PWM?

3. Is there anything else hooked up to this Digital Side Car? Speed controllers? Other switches/sensors?

4. Do these other items on the Digital Side Car work? Are all the green LEDs on?

5. Where is the Digital Side Car hooked up to on the cRIO? To a DIO module in slot 4? Using the originally supplied cable? Are the thumbscrews screwed in?

6. If your switch is hooked up to digital input 4 on the digital side car, and the digital sidecar is hooked up to the cRIO through a DIO module in the fourth slot (fourth counted from the end with the power connector) then your initialization should be:
Code:
Dig4 = new DigitalInput(4);
Can you verify if that is what you are using?

6. Add a printf line to the end of your teleop code:
Code:
printf("DIO4: %d\n",Dig4->Get());
7. Open a Target Console in WindRiver by right-clicking VxWorks6x in the bottom-left window then Target Tools->Target Console

8. The Target Console should now spit out the state of your switch continuously. Does it ever switch from 1 to 0 when you press your switch?

9. Are there any experienced teams in your area you can contact? Two days to burn on a limit switch is too much, and if I were in your shoes, I'd get help in person ASAP. FIRST is a wonderful thing - I'm sure someone would be willing.
__________________
In life, what you give, you keep. What you fail to give, you lose forever...
  #25   Spotlight this post!  
Unread 16-02-2010, 17:53
z2daj z2daj is offline
Registered User
FRC #2836 (Team Beta)
Team Role: Programmer
 
Join Date: Feb 2009
Rookie Year: 2009
Location: Bethlehem, CT
Posts: 15
z2daj is an unknown quantity at this point
Send a message via AIM to z2daj
Re: Limit Switch Draws Tears

Ok guys, after re-reading my posts, I would like to apologize for my rudeness. I let my frustration get the better of me. I left it alone for awhile and let somebody else take control. He told me later that he got it working, although I didn't get to ask how due to the snow.

Thank you all for everything and good luck to you and your teams during these final days of the build season.

-Zach Jasensky
__________________
There is nothing to fear, but fear itself
Closed Thread


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
limit switch solomason519 Programming 9 09-02-2010 08:50
Using a limit switch to limit motion ManicMechanic Programming 16 20-12-2007 00:54
limit switch wedellm Electrical 4 16-02-2007 13:01
Limit Switch Basics JWSnedden Programming 6 30-11-2006 19:48


All times are GMT -5. The time now is 02:19.

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