> >which becomes... > > X/3 = (X*64 + X*16 + X*4 + X + 128)/256 > A few steps further. X/3 = ( X + 4X + 16X + 64X)/256 X/3 = ((X + 4X) + 16(X + 4X))/256 X/3 = ( 5X + 16(5X))/256 Here is the code for the above algorithm. No doubt someone can find a few ways to cut a cycle or two. Currently 23 cycles including rounding etc. 21 cycles if you can accept truncation rather than rounding. DIV3 ; Call with 8bit in W , exit with X/3 in W ; ; RAM: uses T and Xh:Xl ; MOVWF Xl ; CLRF Xh ; RLF Xl,F RLF Xh,F ; X*2 RLF Xl,F ; RLF Xh,F ; X*4 ADDWF Xl,F SKPNC INCF Xh,F ; 5*X ; X = 0J:KL SWAPF Xh,W ; W = J0 MOVWF T ; T = J0 SWAPF Xl,W ; W = LK ANDLW 0x0F ; W = 0K ADDWF T,F ; T = JK ; SWAPF Xl,W ; W = LK ANDLW 0xF0 ; W = L0 ** needed? ADDWF Xl,F ; MOVF Xh,W ; SKPNC ; ADDLW 1 ; ADDWF T,W ; BTFSC Xl,7 ; Round up if >128 ADDLW 1 ; ; result in W Ray Gardiner, Shepparton, Victoria, Australia ray@netspace.net.au