Hi everyone I am trying to use the 16 by 16 bit divide from http://home.netcom.com/~fastfwd/answers.html#PIC00094. I can not get it to work. I am passing the upper byte as HVValueH and the lower as HVValueL to a routine called CalibrateV which calls the divide routine. The values HV_ValueH, HV_ValueL and the values for the divide routine are mirrored in all of the memory banks. Here is my code, if you need to see more of the code let me know. CalibrateV ;Takes HV_ValueL,HV_ValueH, OffsetV,ConvFacV ;HV_ValueH,HV_ValueL =3D (HV_ValueH,HV_ValueL) + ((HV_ValueH,HV_ValueL)/ConvFacV)+OffsetV ;Now it is only a test routine for multiplication=20 BANK0 MOVF HV_ValueH,W ;Puts HV value in Dividen 0x0808 MOVWF DIVIDENDHI=20 MOVF HV_ValueL,W MOVWF DIVIDENDLO MOVLW 0x04 =09 MOVWF DIVISORHI ;Puts 0x0404 in Divisor MOVLW 0x04 MOVWF DIVISORLO PCALL DIVIDE16 ;Calls divide MOVF QUOTIENTHI,W MOVWF HV_ValueH ;Puts values back in HV_Value to be sent out MOVF QUOTIENTLO,W MOVWF HV_ValueL RETURN DIVIDE16: ;16 bit devide ; Enter with Dividend in DIVIDENDHI:DIVIDENDLO, divisor in ; DIVISORHI:DIVISORLO. ; ; Exits with quotient in QUOTIENTHI:QUOTIENTLO, remainder in ; REMAINDERHI:REMAINDERLO. =09 BANK0=09 CLRF REMAINDERHI ;CLEAR THE REMAINDER. CLRF REMAINDERLO ; MOVLW 16 ;WE'RE DIVIDING BY A 16-BIT DIVISOR. MOVWF COUNT ; DIVLOOP: RLF DIVIDENDLO ;SHIFT DIVIDEND LEFT 1 BIT INTO RLF DIVIDENDHI ;REMAINDERHI:REMAINDERLO. RLF REMAINDERLO ; RLF REMAINDERHI ; MOVF DIVISORHI,W ;COMPARE THE DIVISOR TO THE PORTION OF THE SUBWF REMAINDERHI,W ;DIVIDEND THAT'S BEEN SHIFTED INTO REMHI. BTFSS STATUS,Z =20 GOTO CHECKLESS ;IF THE TWO HI-BYTES AREN'T THE SAME, JUMP ;AHEAD. MOVF DIVISORLO,W ;OTHERWISE, WE HAVE TO COMPARE THE SUBWF REMAINDERLO,W ;LO-BYTES. CHECKLESS: =20 BTFSS STATUS,C =20 GOTO NOSUB ;IF THE SHIFTED PORTION OF THE DIVIDEND WAS ;LESS THAN THE DIVISOR, JUMP AHEAD. MOVF DIVISORLO,W ;OTHERWISE, REMAINDER =3D REMAINDER = - DIVISOR. SUBWF REMAINDERLO ; MOVF DIVISORHI,W ; BTFSS STATUS,C ; INCFSZ DIVISORHI ; SUBWF REMAINDERHI ; (CARRY'S ALWAYS SET AT THIS POINT.) NOSUB: =20 RLF QUOTIENTLO ;IF WE JUST SUBTRACTED, SHIFT A "1" INTO RLF QUOTIENTHI ;THE QUOTIENT. OTHERWISE, SHIFT A "0". DECFSZ COUNT ;HAVE WE SHIFTED ENOUGH BITS? GOTO DIVLOOP ;IF NOT, LOOP BACK. RETURN ; AT THIS POINT, THE QUOTIENT IS IN QUOTIENTHI:LO AND THE REMAINDER IS ; IN REMAINDERHI:LO -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics