Hi folks, I'm with problems when doing a "computed goto" with a PIC18F4680. I've debugged a lot of times and I don't know what's happening. I did a sample program to illustrate my problem: The code below works fine because the "computed goto" program area don't = change the PCLATH value. PCLATH always is zero. ----------------------------------------------------------------------- PROGRAM CODE 0x0030 Program: goto Main ANOTHER_AREA CODE 0x80 Main: movlw .2 addwf PCL goto Main0 goto Main2 goto Main4 Main0: nop goto Main Main2: nop goto Main Main4: nop goto Main4 -------------------------------------------------------------------------- However, IF the Main routine is in 0x100 program memory area (or 0x200, = 0x300, and so on), the problem happens and after the addwf a jump to a 0x0n= n = area is performed. THIS CODE DOESN'T = WORKS----------------------------------------------------------------------= ---------------------------------------- PROGRAM CODE 0x0030 blProgram: goto Main ANOTHER_AREA CODE 0x100 Main: movlw .2 addwf PCL goto Main0 goto Main2 goto Main4 Main0: nop goto Main Main2: nop goto Main Main4: nop goto Main4 ---------------------------------------------------------------------------= ----------------------------------------------------------------------- I see in simulator that PCLATH value never is changed. So, when I use ADDWF = PCL, the program jumps to a 0nn relative area insted 1nn. "goto" shouldn't change the complete program counter? Anybody know what I'm doing wrong?? Sorry my bad english but I hope you understood me. Thanks, Eduardo Garcia = _______________________________________________________ = Yahoo! Mail - Sempre a melhor op=E7=E3o para voc=EA! = Experimente j=E1 e veja as novidades. = http://br.yahoo.com/mailbeta/tudonovo/ -- = http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist