> By dithering duty cycle on a 1-instruction basis, resolution can average to > much better than 1-instruction times, if the averaging period is long. > > Here's a simple adaptive algorithm: > > 1. Start an accumulator on duty cycle during the averaging period, or a > moving average across periods. > > 2. If accumulator/average is low, turn on duty cycle. > > 3. If accumulator/average is low, turn off duty cycle. Bresenham's algorithm seems appropriate since it was originally developed as a higher speed alternative to this sort of slope/accumulator calculation. ***************************************************************** Olin Lathrop, embedded systems consultant in Devens Massachusetts (978) 772-3129, olin@embedinc.com, 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