TONY NIXON 54964 wrote: > It's interesting that if you move a value directly into PCL then the > next instruction is fetched from that address value. If you ADD a > value into PCL the next instruction is fetched from the result + 1. Not exactly, Tony. The PIC increments PCL BEFORE executing the current instruction. Here's an example: 0000 CLRF PCLATH 0001 MOVLW 2 0002 ADDWF PCL The Program Counter starts at address 0000. The PIC grabs the "CLRF PCLATH" instruction, then increments the PC (so PCL = 1), then executes the CLRF. Next, the PIC grabs the instruction at address 0001 (since the Program Counter holds 0001), then increments the Program Counter (so PCL = 2), then executes the MOVLW. Next the PIC grabs the instruction at address 0002 (since the Program Counter now holds 0002), then increments the Program Counter (so PCL = 3), THEN performs the ADDWF. Since PCL = 3 when the addition occurs, the result of the ADDWF PCL is 5 (since 3 + 2 = 5). The Program Counter, therefore, holds 0005 after the ADDWF. -Andy === Meet other PICLIST members at the Embedded Systems Conference: === 6:30 pm on Wednesday, 1 October, at Bytecraft Limited's booth. === === For more information on the Embedded Systems Conference, === see: http://www.embedsyscon.com/ === Andrew Warren - fastfwd@ix.netcom.com === Fast Forward Engineering - Vista, California === http://www.geocities.com/SiliconValley/2499