PIC18 cheatsheet

BTFSS

Detailed reference for the BTFSS instruction in PIC18 ISA.

Description

Test the value of bit b in register f. If the bit is set (1), the processor automatically skips the next instruction. If the bit is clear (0), execution continues normally.

  • a = 0f is addressed in the Access bank.
  • a = 1f is addressed in a banked location.
BTFSS f, b [a]

Examples

; a=0 (Access bank) – test bit 1 of PORTA, skip next if set
BTFSS PORTA, 1   ; if PORTA bit1 is 1, the following instruction is skipped
; a=1 (Banked address) – test bit 4 of file register 0xF30, skip next if set
BTFSS 0xF30, 4   ; if bit4 of 0xF30 is 1, the following instruction is skipped