Accelerate/Decelerate PULSOUT
curious1
Posts: 104
My project has a small stepper motor on board . I am uing 2 out pins on the BS2 for step and direction.
·I am increasing and decreasing speeds with·FOR PULSOUT NEXT. It works·really good but is there any way to accel. and decel. with the pulsout ?
·Thanks
·I am increasing and decreasing speeds with·FOR PULSOUT NEXT. It works·really good but is there any way to accel. and decel. with the pulsout ?
·Thanks
Comments
If each time through the loop, you normally change the pulse width by 5%, change it by 10% for a few loops, then change it by 20% for a few loops.
By the way, if you include your current program as an attachment, we would have a better idea of what you're trying to do and possibly make specific suggestions rather than generalities.
counter var word
DO
LOOP UNTIL IN1=1 ' to start
FOR counter = 1 TO 50 ' 1/4 turn ( 200 ppr )
PULSOUT 4, 5
PAUSE 25 ' pretty slow to start , I use the pause low to change speed
NEXT
FOR counter = 1 TO 250 '1-1/4 turns fast
PULSOUT 4, 2 ' I have to keep pulse high at least 4 micro sec. for the driver
PAUSE 0 'I leave the pause out for full speed
NEXT
and so on.....
Then do the same thing to reduce speed by 2 or 3 increments down to creeping speed to a HOME switch that resets for the next cycle.
At the end, I think it goes like this:
DO
PULSOUT 4, 5
Pause 40 "slow creep to home
LOOP UNTIL IN5=1 ' 5 is HOME switch input
LOW 3 ' for direction reversal
LOOP
It coutinues to run until it makes IN5, then stops
It works but I wondered if the stamp could give it an "S Curve" profile or even a "RAMP" like some of the stepper controllers do.
Thanks Mike,
I could leave·each pulsout high for the same time for all speeds, just change count and pause.
Then only 2 var to deal with.
Thanks again.
Post Edited (curious1) : 3/1/2007 12:29:11 PM GMT