Log in

View Full Version : Limit Switch Basics


JWSnedden
27-11-2006, 20:21
How do you program limit switches?

RyanN
27-11-2006, 20:36
How do you program limit switches?

I am not the programmmer, but I am the electrician on our team. A limit switch plugs into a digital I/O port on the controller. The switch is closed when the negative is applied (or so I believe and please correct me if I'm wrong). As far as the programming, I have no idea. So it uses the black and white wires of a PWM cable. When the switch is closed, the program is supposed to respond.

JWSnedden
27-11-2006, 20:40
I am not the programmmer, but I am the electrician on our team. A limit switch plugs into a digital I/O port on the controller. The switch is closed when the negative is applied (or so I believe and please correct me if I'm wrong). As far as the programming, I have no idea. So it uses the black and white wires of a PWM cable. When the switch is closed, the program is supposed to respond.

yes, we knew that. We need to program it. Thank you, though.

Mike Betts
27-11-2006, 20:49
JWS,

When the switch is closed, you will read a 0 and then the switch is open, you will read a 1...


if (rc_dig_in15 == 0)
{
// This will execute when the signal on input 15 is grounded.
}
else
{
// This will execute otherwise (when the switch is open).
}



Does this make sense?

Mike

JWSnedden
27-11-2006, 21:34
Yes Thanks very much!

Stuart
30-11-2006, 18:58
#define leftLS rc_dig_in15
#define rightLS rc_dig_in14

if(leftLS == 0)
//the left limit switch is on
//dont turn left any more
if(rightLS == 0)
//the right limit switch is on
// dont turn right any more


//this post made more since before the nevermind

JWSnedden
30-11-2006, 19:48
Thanks anyway!