> Jean-Louis Vern wrote > >Anybody got a good averaging algorithm? > > ; Offset multibytes variables > MSB EQU 0 > LSB16 EQU 1 > LSB24 EQU 2 > LSB32 EQU 3 > ; The simplest way to averaging, but... integer arithmetic produce > some ; output instabilities... for example : ; if input = constant = > 0xZZ, AVERAGE converges to 0xZZ00 if previous output ; is < 0xZZ, or > converges to 0xZZFF if previous output is > 0xZZ. ; If AVERAGE = > 0xZZFF, and if the new input is 0xZZ+1, the output changes ; > immediately to 0xZZ+1, ; If AVERAGE = 0xZZ00, and if the new input > is 0xZZ-1, the output changes ; immediately to 0xZZ-1 ; To avoid > this problem you need a rounding (see later)... > if 0 Thanks a lot, jean! I am combing through this code to figure out how on it works. Perhaps a more thorough explanation would help. I'm having a rough time following it without comments. Could you explain it in English, or pseudocode? Best Regards, Lawrence Lile