Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Motor Limits (http://www.chiefdelphi.com/forums/showthread.php?t=43277)

Al Skierkiewicz 05-02-2006 15:35

Re: Motor Limits
 
The limit switches will be listed as "micro switches" in a catalog or at Radio Shack. Digikey and Mouser both have tons of different types. On a really important application, back up a pot with a limit switch set (mounted) to the absolute farthest travel you can allow. The pot works but might not stop a fast moving motor in time to prevent damage.

Idaman323 05-02-2006 23:36

Re: Motor Limits
 
Okay, so we got his code from Salad

Quote:

If your motor was hooked to pwm01 you'd use...

Limit_Switch_Max(rc_dig_in01, &pwm01);
Limit_Switch_Min(rc_dig_in02, &pwm01);
Where in the code would you put this? And is this all you would need to get it to work properly?

ForgottenSalad 06-02-2006 00:15

Re: Motor Limits
 
Quote:

Originally Posted by Idaman323
Okay, so we got his code from Salad

Code:

If your motor was hooked to pwm01 you'd use...

Limit_Switch_Max(rc_dig_in01, &pwm01);
Limit_Switch_Min(rc_dig_in02, &pwm01);

Where in the code would you put this? And is this all you would need to get it to work properly?

I don't exactly know why that code wasn't working for us (although it's probably something stupid and obvious that I'm missing) but all it was doing was slowing down our motors when they hit the limit switches instead of stopping them. If someone would please clear that up it would be greatly appreciated by me and I'm sure by Idaman as well.

NOTE: Yes, our speed controllers are calibrated.

Donut 06-02-2006 08:02

Re: Motor Limits
 
That should be the code to stop them. We have it in the code, but haven't tested it yet.

When hit, the limit switch should only stop your motor from moving in one direction, unless their was an error made programming it.

What pwms and inputs are you using when it's not working properly? I keep hearing bad things about pwms 13-16, if you're using one of those try a different one.

Idaman323 06-02-2006 20:56

Re: Motor Limits
 
Hmm, does that get put some where in the user_routines.c file? If so, what section of it? I woudl liek to see how it works with our motors. Thanks

Donut 07-02-2006 00:08

Re: Motor Limits
 
The call to the limit switch function can be put where ever you like it (this will be in a function called in user_routines.c or directly in there), just make sure that it is called AFTER the other code you use to set pwm values. It makes no sense to limit your motor so it can't drive further, then to command it to drive beyond it afterwards, since the last command will be the one the motor sees.


All times are GMT -5. The time now is 20:59.

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