N. T. wrote: > That's a good point. And you could take not the first previous > reading, but also, say, N-th previous reading, depending on the > mechanical properties of the system. This would average readings on > last N values. Not a good idea. Now the timer must not wrap for at least N pulses. What you are really describing is low pass filtering the series of pulse periods, although you're not thinking about it that way. Your average of the last N periods is a low pass filter, just not a particularly good one. There is one advantage in applying a box filter in this case, which is that if you box filter one whole engine revolution of pulses any irregularities in when the pulses occur within a revolution cancel out. In this case, there are two pulses per revolution, so working with the sum of the last tw= o pulses might make some sense. However, I would still compute the period of each pulse separately, just keep the previous period around too. Then do a real low pass filter each pulse on the sum of the last two pulses. That should give you a high quality result. The OP hasn't said what resolution and update rate he needs. Most likely something like a simple two pole low pass filter will be just fine. ******************************************************************** Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products (978) 742-9014. Gold level PIC consultants since 2000. --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .