Hello, I have been having some problems with my linear acceleration routine, and I have not been able to figure out why it does not work correctly. In principal, the a standard linear acceleration should be a constant rate. However, we I command my stepper motors to move, they begin to accelerate at a slow rate and then just kick into a really fast mode. Almost like it skipped over the acceleration once it hit a threshold speed. So here is what I am doing. GIVEN: Device frequency 40MHz Motor+lead+microstepratio = 3200 steps per inch of travel. Timer0 is used for the acceleration motion Timer1 is used for normal motion after acceleration has completed. Timer3 is used as constant acceleration clock. Given an acceleration rate in inchs^2^2. Initial stepping rate is 0.125"/sec this yields an initial Timer1 value of 0xcf2b calculated as follows: TimeValue = 0Xffff-((40MHz/4)/(Speed in inches/sec * 3200)) I have the following variables: ACCELMOTION_L,ACCELMOTION_H ;Used for timer 0 during acceleration. Initial set to 0Xcf2b MOTIONRATE_L,MOTIONRATE_H ;Desired speed after acceleration ACCELCLK_L,ACCELCLK_H ;Used to compute new ACCELMOTION during acceleration. Now, I desire a rate of acceleration of 30"/sec^2^2 So Timer 3 (ACCELCLK) =0xffff-((40MHz/4)/(30*3200)) = 0xff97 Now, on every Timer3 interrupt, I increment ACCELMOTION but one. However, Timer0 is not updated until it completes it's current timeout which is now ACCELMOTION-1 and any clock cycles since. In Timer3 interrupt, when ACCELMOTION>=MOTIONRATE, the acceleration has finished, the Timer3 is disabled. On the completion of timer0 interrupt, timer0 is disabled and timer 1 is enabled and equals MOTIONRATE constant velocity. Now, if I am correct, this should product a even, steady acceleration to commanded speed correct???. Is there a better way to do this? This should produce a smooth rate of motion, not a slow accel and then all of a sudden it accelerates very fast. Thanks, James -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads