Roberts II, Charles K. wrote: > 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. > It will give 4096, 22561, and 8 The output of the DIVIDE16 routine depends ONLY on the initial values of DIVIDENDHI:LO and DIVISORHI:LO. Since you're getting different answers each time you call the routine, you're either not giving it the same dividend and divisor values each time, or looking at something other than its output. Some possible reasons: 1. Writing or reading to the wrong bank in your main code, in DIVIDE16, and/or in transmitw. 2. PCALL macro not correctly setting the code-page bits. 3. PCALL macro corrupting W. 4. Transmitw has a bug. 5. Interrupt routine executing, and not properly saving/restoring all the SFRs it modifies. 6. Stack overflow. 7. Etc. An emulator or debugger would help a lot in this situation... -Andy === Andrew Warren -- aiw@cypress.com === Principal Design Engineer === Cypress Semiconductor Corporation === === Opinions expressed above do not === necessarily represent those of === Cypress Semiconductor Corporation -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.