Trapezoidal motion profile with fixed-point math

Hello friends,

I’d like to introduce myself. My name is Gabriel, I live in Argentina (excuse me please if my english isn’t good), I study electronics engineering, and my hobby is embedded systems designing and programming.
Recently I’ve been working with a DC motor servo control. Finished PID loop, and now working with motion profile.

Architecture is based on LM628, but implemented with dsPIC33FJ microcontroller. Because it is a fixed-point processor, I am doing all math that way. No problems with PID loop. But with motion profile I find quite difficult to manage “discretization accumulated error”. I mean, when doing these integrations:
position1 = position0 + velocity0 + acceleration/2;
velocity1 = velocity0 + acceleration;

discretization error (large enough with Q15.16 fixed-point) integrates too, and the final position isn’t correct.
Michrochip 0718 appnote deals with this, just commanding final position when trapezoidal profile finished; but obviously this produces a little jerk because of the error.

I taked a look a this thread:
http://www.chiefdelphi.com/forums/showthread.php?t=98358&page=4&highlight=trapezoidal

and learned a lot; but people uses floating-point here and that’s not exactly what I’m looking for.

Any help is appreciated. Have a nice weekend.:slight_smile:

Gabriel