Hi Andrew.
I got some time and tried to rewrite your filter code to optimize it a little bit.
The formula can be rewritten as: Ave' = Ave + ( New - Ave )/16 ;
Used the same names for variables. TEMP cell isn't used.
I having more and more believing that 12 is some magical number for small completed code fragments. ;)
; Initially written by Andrew Warren (fastfwd at ix.netcom.com).
; Optimized by Dmitry A. Kiryashov (zews at aha.ru) 06/18/2000
; 12 clocks/words
Filter:
movfw AVE
subwf NEW,F ;NEW - AVE
swapf NEW,W
andlw 0x0F ;get /16 int part
skpc ;result is neg?
iorlw 0xF0 ;yes
addwf AVE,F
swapf NEW,W
andlw 0xF0 ;get /16 frac part
addwf AVFRAC,F
skpnc
incf AVE,F
;
; low nibble of AVFRAC isn't used
; so we can utilize it for other purposes ;)