Professional Documents
Culture Documents
2.5 Bit Control Instructions1 PDF
2.5 Bit Control Instructions1 PDF
instructions
Syntax:
Syntax: [[ label
label ]] BSF
BSF f,b
f,b
Operands:
Operands: 00 ≤≤ ff ≤≤ 127
127
00 ≥≥ bb ≤≤ 77
Operation:
Operation: 11 → (f<b>)
→ (f<b>)
Status Affected:
Status Affected: None
None
BSF
BSF STATUS, RP1
STATUS, RP1
BSF
BSF STATUS, RP0
STATUS, RP0
Syntax: [[ label
Syntax: label ]] BCF
BCF f,b
f,b
Operands:
Operands: 00 ≤≤ ff ≤≤ 127
127
00 ≥≥ bb ≤≤ 77
Operation:
Operation: 00 → (f<b>)
→ (f<b>)
Status Affected:
Status Affected: None
None
BCF PORTA,
BCF PORTA, 00
BCF PORTA,
BCF PORTA, 55
BCF 05,
BCF 05, 00
BCF 05,
BCF 05, 55
0 0
1 1 1
0 0 0
BSF
BSF 0X05, 00
0X05,
BSF
BSF 0X05, 11
0X05,
BSF
BSF 0X05, 22
0X05,
BCF
BCF 0X05, 22
0X05,
BCF
BCF 0X05, 11
0X05,
BCF
BCF 0X05, 00
0X05,
Prepared by : Maher Al -Omari
Bit Test
Bit Test file
file and
and Skip
Skip ifif Set
Set
BTFSS F,b
BTFSS F,b
Syntax:
Syntax: BTFSS f,b
BTFSS f,b
Operands:
Operands: 00 ≤≤ ff ≤≤ 127
127 ,, 00 ≤≤ bb ≤≤ 77
Operation:
Operation: skip ifif (f<b>)
skip (f<b>) == 11
Status Affected:
Status Affected: None None
Description:IfIfbit
Description: bit‘b’
‘b’in
inregister
register ‘f’
‘f’is
is‘0’,
‘0’,the
thenext
next
instructionis
instruction isexecuted.
executed.IfIfbit
bit‘b’
‘b’is
is‘1’,
‘1’,then
thenthe
thenext
next
instructionis
instruction isdiscarded
discardedandandaaNOP
NOPis isexecuted
executed
instead,making
instead, makingthis
thisaatwo-cycle
two-cycleinstruction.
instruction.
MOVLW
MOVLW 0X0F
0X0F
BTFSS
BTFSS PORTA,4
PORTA,4
ANDWF
ANDWF PORTB
PORTB
IORWF
IORWF PORTC
PORTC
Syntax:
Syntax: [[ label
label ]] BTFSC
BTFSC f,b f,b
Operands:
Operands: 00 ≤≤ ff ≤≤ 127
127 ,, 00 ≤≤ bb ≤≤ 77
Operation:
Operation: skip ifif (f<b>)
skip (f<b>) == 00
Status Affected:
Status Affected: None
None
MOVLW
MOVLW 0X0F
0X0F
BTFSC
BTFSC PORTA,7
PORTA,7
ANDWF
ANDWF PORTB
PORTB
IORWF
IORWF PORTC
PORTC
delay
delay MOVLW
MOVLW 0xFF;;
0xFF
MOVWF
MOVWF Count
Count
down
down DECFSZ
DECFSZ Count
Count
down؛؛
GOTO down
GOTO