Here's a divide-by-3 routine that my son Paul (fmdesignpe@aol.com) reminded me of when I admitted I couldn't remember. It's not fast, but is real simple to understand, and can easily be generalized to divide by any integer. Number (unsigned byte) to divide in X. Scratch files L (little) and B (big), both initialized to 0. Loop add 3 to B is B greater than X ? if so: we're done, with answer in L if not: add 1 to L and go to Loop We're filling B three times as fast as we are L, so when B exceeds X, L is one third of X. Here's the code: btst movlw 3 addwf B,F ;add 3 to B movf B,W subwf X,W ;compare B to X btfss STATUS,C ;if Carry set, B <= X, so increment L and loop goto done ;if not, we're done incf L,F ;add 1 to L goto btst ; and loop again done ;result is in L Works with any divisor. To divide by 13, just change the first instruction to "movlw 13". -- Mel Evans mevans1027@aol.com 813/595-7685