4.1.8 Relative Branches
The PIC18 devices implement conditional relative branch instructions,
e.g., bz
, bnz
. These instructions have a limited jump
range compared to the goto
instruction.
Unlike the MPLAB XC8 C Compiler, the PIC Assembler will never
transform relative branch sequences to increase their range. If you need a relative branch
that can reach targets outside the usual instruction range, use a relative branch with the
reverse condition over a
goto
instruction. For example, instead of
writing: bz next
write something
like: bnz tmp
goto next
tmp: