> > Suppose the gyro burst only adds to a counter that keeps track of > > pending pulses to be sent to the motor, and the counter is decremented > > for every pulse sent. Whenever a gyro burst comes in and the counter is > > updated, calculate the new period between pulses so that the counter > > would reach zero a bit after the latest time for the next gyro pulse, like > > 20mS for example > > Yes, there's something in that. The big fly in the ointment is if there's > a direction change. I thought I had it all sorted out at the weekend > until I "remembered" about direction changes. Does tend to mess > things up a little I don't see why direction change is a problem. One direction adds to the counter, the other subtracts. A similar increment or decrement is done whenever a pulse is emitted. Each time a gyro burst comes in, you compute the signed pulses represented by that burst and add it into the counter. Then you compute the pulse period and step direction for the next interval from the current counter value regardless of how it got there. ***************************************************************** Embed Inc, embedded system specialists in Littleton Massachusetts (978) 742-9014, http://www.embedinc.com -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body