PIC18 cheatsheet

BNC

Detailed reference for the BNC instruction in PIC18 ISA.

Description

Branch if NOT Carry (BNC).

Performs a relative branch if the Carry flag (C) is cleared.

  • If C = 0, the program counter (PC) is updated with the relative offset specified by the label (K).
  • If C = 1, the instruction is a no‑op and execution continues with the next instruction.

The branch target is specified by a label; the assembler automatically encodes the offset.

Examples

; Branch taken if Carry cleared
CLRC
BNC BranchTaken ; PC jumps to BranchTaken because C=0
; Branch not taken because Carry set
SETC
BNC BranchTaken ; execution continues after BNC because C=1
; Simple BNC use with a label offset
BNC OffLabel ; relative branch to OffLabel when C=0