I have come up with a perfect acceleration routine that works good for me. It allows me to get my steppers turning at 30rev/s I use three timers. One for the acceleration, one for a constant speed after acceleration and one for a constant time interval of 1ms which I use to update the acceleration timer. On every 1ms interval, I increase accelerations timer values by 0x60 (30"/sec^2) of acceleration. Once, the acceleration timer value = constant speed, then I disable timer 3, 0 and enable the constant speed timer of The acceleration value was calculated as follows: 30"/sec^2*0.001 = 0.03"/1ms On my system 1" = 3200 steps so 0.03*3200 = 96 or 0x60. So for every millisecond, I add 0x60 to the acceleration timer, until it's value has reached the desired constant speed value of the corresponding timer. Regards, James -----Original Message----- From: pic microcontroller discussion list [mailto:PICLIST@MITVMA.MIT.EDU] On Behalf Of Francisco Ares Sent: Monday, August 05, 2002 5:25 PM To: PICLIST@MITVMA.MIT.EDU Subject: stepper motor de/acceleration Hi all PIClisters. Can someone point me to an algorithim to do accelaration for a stepper motor controller? My controller uses one timer overflow ISR to switch the phases of the motor, so the speed is calculated through the period register of this timer. I need to calculate different values for the period register for a constant (or close to constant) acceleration, preferably "on-the-fly", inside the same ISR. My first atempts resulted in that the final speed was never reached because of accumulating errors in calculations. Any hints? Thank you all. Francisco -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics