PicDude wrote: > Got a problem here with a PIC application where the lowest (rightmost) > digit of a numerical value is "toggling" back and forth between 2 > (consecutive) values rapidly -- example it will jump back and forth > between 283 and 284 rapidly (like 3-4 times a second, which is the > update rate on the display). That is expected when taking real world measurements. No amount of linear filtering can prevent the resulting signal from going back and forth accross a specific threshold. > I've come up with a routine that is somewhat crude -- it keeps track of > the last 3 calculated values (sort of a FIFO), and if a new value > varies by exactly +/-1 from the last displayed value, then it does not > immediately update the display -- it waits until that new value is the > result for 3 consecutive cycles. If it goes back to the last displayed > value within the next 2 cycles, then no change will be seen. If the > change is more than 1 at any time, it updates the display immediately. > But I'm guessing there's a better way -- is there? The first thing to ask is why the display update needs to be so fast. If numbers changing every update is annoying or diffucult to read, then it sounds like the display is being updated to quickly. Try every 250-500mS. ***************************************************************** Embed Inc, embedded system specialists in Littleton Massachusetts (978) 742-9014, http://www.embedinc.com -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist