On the PIC18, a GOTO instruction is 4 bytes long. The second half of it, treated as an instruction itself, is a NOP. If you want a 2 byte branch you need to use the BRA instruction, but be aware that unlike a GOTO, a BRA has a limited target range. Also, a quite note: remember that program memory on the PIC18 is byte addressed, so by sure that W is a multiple of 2 (for BRA) or 4 (for GOTO) before the ADDWF PCL instruction. Bob Ammerman RAm Systems ----- Original Message ----- From: "gtyler" To: Sent: Saturday, January 03, 2004 1:38 AM Subject: Appearing NOP's > Hi, I have a strange case of appearing NOP's :) > This is the assembly code I have written in MPLAB 6.4 > ie. what is in the .asm file: > > Line # > 22 addwf PCL,1,0 > 23 goto RS0 > 24 goto RS1 > 25 goto RS2 > 26 goto RS3 > 27 return > > But when I assemble it, I get this in the "Program Memory" file, this is > from the .hex file: > > Line# Address > 18 22 ADDWF 0xff9, 0x1, 0 > 19 24 GOTO 0x36 > 20 26 NOP > 21 28 GOTO 0x42 > 22 2A NOP > 23 2C GOTO 0x4c > 24 2E NOP > 25 30 GOTO 0x56 > 26 32 NOP > 27 34 RETURN 0 > > There are strange NOP's that it has added in every 4 memory locations. > Why does the Assembler do this? Is there any way to stop it doing this? > > Thanks > Christopher Tyler > > -- > 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 list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics