> 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. > If I divide every value before adding them up I get very arbitrary > averages from low input numbers due to rounding errors. Is there a > possibility to do 16 bit integer arithmetric with two data registers. How 'bout something like this? ;initialization clrf sum1 clrf sum2 ;add in new number (num) - 16 bit addition movf num, W addwf sum1, F clrw btfsc STATUS, C movlw 1 addwf sum2, F return ;find average - don't care what's rotated into sum2 movlw 3 movwf temp loop rrf sum2, F rrf sum1, F decfsz temp, F goto loop ;sum1 contains the result 15 instructions, 1 non-global temp register, 2 global sum registers, 98 cycles (including calls to addition routine) By the way, this only works for values 0-255. I haven't tested this, so I could be totally wrong. Jason Harris