Thanks a lot, Peter, but this would give equal period steps, and what I need is equal speed steps (a constant acceleration is dv/dt and the period of the timer is the inverse of that). Thanks anyway. Any other hints? Francisco Peter L. Peres wrote: >On Mon, 5 Aug 2002, Francisco Ares wrote: > > > >>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. >> >> > >For each 'step' of acceleration you compute Time1 = Time0 - dt and set the >timer to that. dt is set previously = (Starttime - Fasttime)/Numsteps, >where Numsteps is the number of intermediate speeds you need and Starttime >a timer value that corresponds to a minimum safe starting speed. When >Time0 == Fasttime you have arrived to max speed. > >Peter > >-- >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