PIC18 cheatsheet

SETF

Detailed reference for the SETF instruction in PIC18 ISA.

Description

The SETF instruction sets the specified file register to logical 1.

  • d = 0 → the result (logic 1) is stored in WREG.
  • d = 1 → the result is written back to the file register f.
  • The instruction does not use the a (access/banked) operand; addressing is performed using the normal file register syntax.

Examples

; d=0  → result in WREG
SETF 0x20, 0   ; W = 1
; d=1  → result back to file register
SETF 0x20, 1   ; 0x20 = 1