PIC program word

Status
Not open for further replies.
I found the following link to a delay code generator



Further down the site a comment is placed. It tells that the goto $+1 should be goto $+6 for PIC18 - that sounds like a huge change... right?
 
Why not just use code designed for the 18F series chip:

I think he meant that goto $+2 should be goto $+6 and that goto $+1 should be goto $+4 for PIC18.
 
What does the goto $+6 command actually do and how many instruction cycles does it use? I can't find it in .asm programming manuals
 
It jumps forward 6 bytes in the program code on a 18F ( 6 instruction words on a 16F) and eats up 2 cycles on the 16F or 18F. On a 16F PIC it would skip 6 instructions which include the goto itself. On an 18F PIC it would skip the goto instruction (4 bytes) plus one regular instruction (2 bytes). Another reason to abhor the goto $ + x mnemonic. Now, if you used a label, the code would compile properly on both the 16F and 18F series. The timing would be wrong, but program flow would be maintained
 
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…