> Andy Shaw wrote: > >Hi Folks, > >Does anyone out there have any code for a reasonably > >fast divide by 10 routine. I'm just looking for a rounded > >up 8 bit signed value as the result I don't need the > >remainder. X / 10 = X * 1/10 Is this right ? ;) 1/10 = (1/16 + 1/32) + (1/256 + 1/512) + .... 1/16 + 1/32 + 1/256 = 0,09765625 (-0,0234375%) ( 1 + 1/2 + 1/16 ) / 16 ; ;code ;initial var X ;result var Y ;+1/2 clrc rrf X,W movwf Y ;+1/16 swapf X,W andlw 0xF addwf Y,F ;+1 movfw X addwf Y,F ;/16 swapf Y,W andlw 0xF skpnc addlw 0x10 movwf Y ; ; Caution: this code is not tested !!! I think there are way to shrink this code . WBR Dmitry.