> The gyro puts out 38k4 data bursts at the rate of 75 - 77 bursts > per second. The information in the data is converted to a number > of pulses that are sent to motor drivers. Everything is working.... > > .....except. The motors really perform best when supplied with > evenly-spaced pulses. At present each motor is set to require > 1200 pulses to move a gearbox 1 degree > > The problem is that the bursts (as measured from the end of the > fifth byte in one to the end of the fifth byte in the next) are not evenly > spread, and can be anywhere from 11 to 14ms apart. This sounds to me like a filtering problem. You have data coming in in bursts, and need to send it out smoothly in time. I'm not totally clear on this, but I guess each gyro burst indicates a number of pulses that need to be sent to a motor over the next 11 to 14mS or so. 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. This would keep the pulses coming regularly, with a change in pulse period after every gyro burst. If you want to smooth that out too, just low pass filter the pulse period a bit. You get smooth operation at the cost of some lag. I can't tell if that's acceptable. It seems the most time-critical thing you are doing is producing the regular pulses. I would therefore generate the pulses from an interrupt. This shouldn't take many cycles on the average, so there are plenty left for the foreground loop to receive the gyro bursts, determine the number of resulting motor pulses, update the pending pulses counter, and compute the new pulse period. ***************************************************************** 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