>Hello! > >Is there a simple way to Divide an 8 or 16 bit # by 47 that doesn't take >10,000 instructions (slight exaggeration)? I don't need a lot of accuracy. Yes there is... Here's a routine from Bob Fehrenbach that should do the trick. I will be putting this on my web page along with a number of other 16 bit routines for the PIC. myke ;******************************************************************* ; Divide 16 bits by 8 bits, 16 bit result, 8 bit remainder. ; Conventional shift and subtract ; ; q_2 : q_1 / n_1 -> q_2:q_1, rem in t_1 ; ; Uses count, t_2 ; Program memory: 16 ; 231 clock cycles. ; Source: Bob Fehrenbach ;******************************************************************* div16b8: macro local loop clrf t_1 movlw 16 movwf count loop: rlf q_1, f rlf q_2, f rlf t_1, f rlf t_2, f movf n_1, w subwf t_1,w btfss t_2, 0 skpnc movwf t_1 btfsc t_2, 0 rrf t_2, f decfsz count, f goto loop rlf q_1, f rlf q_2, f endm PICLite has been upgraded! Check out version 2.00a at: http://www.myke.com/piclite PICLite now includes a Macro Processor that allows structured programming language constructs ("if/else/end", "while/end" and "for/end"). Look in on the life of the Rabitte family in Dublin; Roddy Doyle's "Barrytown Trilogy" in the Book Room this week, http://www.myke.com/Book_Room