>missing op codes. I can probably figure this out eventually, but I have a >deadline issue and would like to know if ANYONE has a working & tested >procedure for the 18Fxxx series chips with sufficient documentation that it >can be used without a lot of hacking. Try this - a bit larger but a bit faster... Djula ;CONVERT TWO BYTE WORD TO FIVE BCD DIGITS (65 cycles) ;Input bytes: BinHi:BinLo ;Output digits: Dg10000:Dg1000:Dg100:BinHi:BinLo ;Trashes: PRODH, PRODL WordBCD rrcf BinHi,w ;Divide by 1000 rrcf WREG,f ;Start with divide by 1024 andlw B'00111111' ; movwf Dg1000 ;Result to Dg1000 mullw .24 ;Correction factor = 24 (1024-1000) movlw B'00000011' ;Calculate /1024 remainder andwf BinHi,f ; movf PRODL,w ;Add correction factor addwf BinLo,f ;to remainder movf PRODH,w ;(maximum possible value is 2535) addwfc BinHi,f ; movlw low .1000 ; subwf BinLo,f ;Subtract 1000 movlw high .1000 ; subwfb BinHi,f ; bnc Fix1000 ;Abort if negative incf Dg1000,f ;Still positive, increment thousands movlw low .1000 ; subwf BinLo,f ;Subtract 1000 movlw high .1000 ; subwfb BinHi,f ; bnc Fix1000 ;Abort if negative incf Dg1000,f ;Still positive, increment thousands bra End1000 ;Done Fix1000 movlw low .1000 ;Negative, add 1000 addwf BinLo,f ; movlw high .1000 ; addwfc BinHi,f ; End1000 rlcf BinLo,w ;Divide remainder by 100 rlcf BinHi,w ;Start with divide by 128 andlw B'00000111' ; movwf Dg100 ;Result to Dg100 mullw .28 ;Correction factor = 28 (128-100) bcf BinLo,7 ;Calculate /128 remainder movf PRODL,w ;Add correction factor to remainder addwf BinLo,f ;(maximum possible value is 299) bnc Less256 ;No carry, ramainder < 256 movlw -.200 ;Remainder >=256 addwf BinLo,f ;Subtract 200 incf Dg100,f ;Increment hundreds twice incf Dg100,f ; bra End100 ;Done Less256 movlw .100 ; subwf BinLo,f ;Subtract 100 bnc Fix100 ;Abort if negative incf Dg100,f ;Still positive, increment hundreds subwf BinLo,f ;Subtract 100 bnc Fix100 ;Abort if negative infsnz Dg100,f ;Positive, incr. hundreds, skip next Fix100 addwf BinLo,f ;Negative, add 100 End100 movf Dg1000,w ;Now we have: TT:H:OO mullw .205 ;Dg1000*1000 + Dg100*100 + BinLo*1 movlw .32 ;Split Dg1000 to two digits mulwf PRODH ;Multiply by 0.1 movf PRODH,w ;(205/256 * 32/256) movwf Dg10000 ;Result to Dg10000 mullw .10 ;Multiply by 10 movf PRODL,w ;Subtract from original Dg1000 subwf Dg1000,f ;Remainder is Dg1000 movf BinLo,w ;Split BinLo to two digits mullw .205 ; movlw .32 ;Multiply by 0.1 mulwf PRODH ;(205/256 * 32/256) movf PRODH,w ; movwf BinHi ;Result to BinHi mullw .10 ;Multiply by 10 movf PRODL,w ;Subtract from original BinLo subwf BinLo,f ;Remainder is BinLo return ;Done -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.