PIC18 cheatsheet

BZ

Detailed reference for the BZ instruction in PIC18 ISA.

Description

Branch if Zero flag (Z) is set.

  • When the Z flag of the STATUS register is 1, the program counter jumps to the label.
  • If Z is 0, execution continues with the following instruction.
  • No operands other than a label are required.

Examples

; BZ target - branch taken when Z=1
BZ target ; Jump to target because Z flag is set
; BZ target - no branch when Z=0
BZ target ; Execution continues with the next instruction
; BZ end - example of a label defined later in code
BZ end   ; Branch to the end label, skipping intermediate code