Ralf Sigmund wrote: > So I would like to implement a running average algorithm, which gives > the average of the last eight values. > It should add up the last eight values and divide then by 8. > but my values can be everything between 256 and 0. Ralf, Is it necessary to average the last 8 values non-recursively? In other words, you're proposing a low-pass digital FIR (finite impulse response) filter. The frequency response is "okay", but... Have you considered an IIR (infinite impulse response) filter? Specifically, I've had good results with filters of this type: avg = (m*avg + n*sample) /(m+n) e.g. If I wish to give the average more weight than the current sample: avg = (3*avg + sample)/4 Or, vice-versa: avg = (avg + 3*sample)/4 An example of the later case implemented in ASM (and untested): CLRF temp CLRC RLF sample,W ;W = 2*sample RLF temp,F ;Catch the carry ADDWF sample,W ;W = 3*sample SKPNC INCF temp,F ;Catch the carry again ADDWF avg,F ;avg = avg+3*sample SKPNC INCF temp,F RRF temp,F ;Get the carries RRF avg,F ;avg /= 2 RRF temp,F RRF avg,F ;avg /= 4 14 Cycles Scott -- "The problem with television is not the resolution." Hugh. F. Frohbach