It's useless to me. I thougth It would be helpfull to my project,... it wouldn't. Anyway, following Andy's line, this code came out. Its saves some instructions cycles but not too much. Regards, Dennis Crawley ; Ave' = Ave + ( New - Ave )/32 ; AHI:ALO = AVERAGE, NHI:NLO = NEW DATA BCF STATUS,RP0 ;NHI:NLO = N - A. MOVF ALO,W ; SUBWF NLO,f ; MOVF AHI,W ; SKPC ; INCFSZ AHI,W ; SUBWF NHI,f ; MOVLW 11100000b ; ANDWF NLO,F ; RRF NHI,W ; RRF NLO,F ; ANDLW 00001111B ; IORWF NLO,F ; RRF NHI,W ; ANDLW 11110000b ; BTFSC NHI,7 ; IORLW 10001111B ; MOVWF NHI ; SWAPF NHI,F ; SWAPF NLO,W ;NHI:W = N/32. ; ADDWF ALO,f ; SKPNC ; INCF AHI,f ; MOVF NHI,W ; ADDWF AHI,f ;AHI:ALO = A + NHI:W. some values tested NewD Ave ;.... 7D4F ;17B6 7A22 ;17B6 770E ;17B6 7413 ;B478 7616 ;... F2A ;F0A F29 ;F50 F2A ;F3C F2A ;.... 123C ;1450 124C ;1482 125D ;1464 126D ;14AA 127E ;14AA 128F ;14DC 12A1 ;14F0 12B3 ;14F0 12C4 -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu