I made the suggested changes to the code. I have tried dividing different numbers and get strange results. Here is what I am seeing. For: MOVLW 0x01 MOVWF DIVIDENDHI=20 MOVLW 0xF4 MOVWF DIVIDENDLO MOVLW 0x00 MOVWF DIVISORHI=20 MOVLW 0x02 MOVWF DIVISORLO I get 0xE8E8 And with MOVLW 0x03 MOVWF DIVIDENDHI=20 MOVLW 0xE8 MOVWF DIVIDENDLO MOVLW 0x00 MOVWF DIVISORHI=20 MOVLW 0x02 MOVWF DIVISORLO I get 0x0758 And if I divide 16/2 I get 8, sometimes.=20 TX_V BANK0 MOVLW 0x00 MOVWF DIVIDENDHI=20 MOVLW 0x10 MOVWF DIVIDENDLO MOVLW 0x00 MOVWF DIVISORHI=20 MOVLW 0x02 MOVWF DIVISORLO PCALL DIVIDE16 MOVF QUOTIENTLO,W PCALL transmitw MOVF QUOTIENTHI,W PCALL transmitw GOTO RX_CMD_FINISH It cycles through a couple of answers each time it is called.=20 It will give 4096, 22561, and 8=20 Any ideas Charles K Roberts II -----Original Message----- From: pic microcontroller discussion list [mailto:PICLIST@MITVMA.MIT.EDU] On Behalf Of Andrew Warren Sent: Wednesday, November 19, 2003 2:58 PM To: PICLIST@MITVMA.MIT.EDU Subject: Re: [PIC]: 16 bit by 16 bit unsigned divide with PIC 17F873A I just wrote (although I should really know better): > Since the code is known to work (I wouldn't have put it on my web page > if it didn't), the problem must be elsewhere. Just noticed an error in the code posted to my web page: There's an "INCFSZ DIVISORHI" near the end of it; that line should read "INCFSZ DIVISORHI,W". Even WITH the error, though, the code produces the correct result when given the particular inputs you were using (dividend =3D 0x0808, divisor =3D 0x0404), so I still suspect that there's a radix issue in your implementation. -Andy =3D=3D=3D Andrew Warren -- aiw@cypress.com =3D=3D=3D Principal Design Engineer =3D=3D=3D Cypress Semiconductor Corporation =3D=3D=3D =3D=3D=3D Opinions expressed above do not =3D=3D=3D necessarily represent those of =3D=3D=3D Cypress Semiconductor Corporation -- 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 -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.