PIC16F5X
BSF
Bit Set f
BTFSS
Bit Test f, Skip if Set
Syntax:
[ label ] BSF f, b
Syntax:
[ label ] BTFSS f, b
Operands:
0 ≤ f ≤ 31
0 ≤ b ≤ 7
Operands:
0 ≤ f ≤ 31
0 ≤ b < 7
Operation:
1 → (f<b>)
Operation:
skip if (f<b>) = 1
Status Affected: None
Status Affected: None
Encoding:
Description:
Words:
0101
bbbf
ffff
Encoding:
0111
bbbf
ffff
Bit ‘b’ in register ‘f’ is set.
Description:
If bit ‘b’ in register ‘f’ is ‘1’, then the
next instruction is skipped.
1
1
If bit ‘b’ is ‘1’, then the next instruc-
tion fetched during the current
instruction execution is discarded
and a NOPis executed instead,
making this a two-cycle instruction.
Cycles:
Example:
BSF
FLAG_REG,
7
Before Instruction
FLAG_REG = 0x0A
After Instruction
FLAG_REG = 0x8A
Words:
1
Cycles:
Example:
1(2)
HERE
FALSE GOTO
TRUE
BTFSS FLAG,1
PROCESS_CODE
•
•
•
BTFSC
Bit Test f, Skip if Clear
Syntax:
[ label ] BTFSC f, b
Operands:
0 ≤ f ≤ 31
0 ≤ b ≤ 7
Before Instruction
PC
After Instruction
If FLAG<1>
PC
=
address (HERE)
Operation:
skip if (f<b>) = 0
Status Affected: None
=
=
=
=
0,
address (FALSE);
1,
address (TRUE)
Encoding:
0110
bbbf
ffff
if FLAG<1>
PC
Description:
If bit ‘b’ in register ‘f’ is ‘0’, then the
next instruction is skipped.
If bit ‘b’ is ‘0’, then the next instruc-
tion fetched during the current
instruction execution is discarded
and a NOPis executed instead,
making this a two-cycle instruction.
Words:
1
Cycles:
Example:
1(2)
HERE
FALSE GOTO
BTFSC FLAG,1
PROCESS_CODE
TRUE
•
•
•
Before Instruction
PC
=
address (HERE)
After Instruction
if FLAG<1>
PC
=
=
=
=
0,
address (TRUE);
1,
address(FALSE)
if FLAG<1>
PC
DS41213D-page 44
© 2007 Microchip Technology Inc.