Bit-oriented Instructions
Similar to logic instructions, bit-oriented instructions perform logic operations. The difference is that these are performed upon single bits.ANL C,bit - AND direct bit to the carry flag
C: Carry flag
Bit: any bit of RAM
Description: Instruction performs logic AND operation between the direct bit and the carry flag.
EXAMPLE:

Before execution: ACC= 43h (01000011 Bin.)
C=1
After execution: ACC= 43h (01000011 Bin.)
C=0
ANL C,/bit - AND complements of direct bit to the carry flag
C: carry flag
Bit: any bit of RAM
Description: Instruction performs logic AND operation between inverted addressed bit and the carry flag. The result is stored in the carry flag.
EXAMPLE:

Before execution: ACC= 43h (01000011 Bin.)
C=1
After execution: ACC= 43h (01000011 Bin.)
C=1
CLR C - clears the carry flag
C: Carry flag
Description: Instruction clears the carry flag.
EXAMPLE:

After execution: C=0
CLR bit - clears the direct bit
Bit: any bit of RAM
Description: Instruction clears the specified bit.
EXAMPLE:

Before execution: P0.3=1 (input pin)
After execution: P0.3=0 (output pin)
CPL bit - Complements the direct bit
Bit: any bit of RAM
Description: Instruction coplements the specified bit of RAM (0==>1, 1==>0).
EXAMPLE:

Before execution: P0.3=1 (input pin)
After execution: P0.3=0 (output pin)
CPL C - Complements the carry flag
C: Carry flag
Description: Instruction complements the carry flag (0==>1, 1==>0).
EXAMPLE:

Before execution: C=1
After execution: C=0
MOV bit,C - Moves the carry flag to the direct bit
C: Carry flag
Bit: any bit of RAM
Description: Instruction moves the carry flag to the direct bit. After executing the instruction, the carry flag is not affected.
EXAMPLE:

After execution: If C=0 P1.2=0
If C=1 P1.2=1
MOV C,bit - Moves the direct bit to the carry flag
C: Carry flag
Bit: any bit of RAM
Description: Instruction moves the direct bit to the carry flag. After executing the instruction, the bit is not affected.
EXAMPLE:

After execution: If P1.4=0 C=0
If P1.4=1 C=1
ORL C,bit - OR direct bit to the carry flag
C: Carry flag
Bit: any bit of RAM
Description: Instruction performs logic OR operation between the direct bit and the carry flag. The result is stored in the carry flag.
EXAMPLE:

Before execution: ACC= C6h (11001010 Bin.)
C=0
After execution: C=1
ORL C,/bit - OR complements of direct bit to the carry flag
C: carry flag
Bit: any bit of RAM
Description: Instruction performs logic OR operation between the addressed inverted bit and the carry flag. The result is stored in the carry flag.
EXAMPLE:

Before execution: ACC= C6h (11001010 Bin.)
C=0
After execution: C=0
SETB C - Sets the carry flag
C: Carry flag
Description: Instruction sets the carry flag.
EXAMPLE:

SETB bit - Sets the direct bit
Bit: any bit of RAM
Description: Instruction sets the specified bit. The register containing that bit must belong to the group of the so called bit addressable registers.
EXAMPLE:

Before execution: P0.1 = 34h (00110100)
pin 1 is configured as an output
After execution: P0.1 = 35h (00110101)
pin 1 is configured as an input
Next Post:Logical Instruction
Previous Post:Arithmetic Instruction
Related Topics:
-> Function of microcontroller 8051 ports
-> I/O PROGRAMMING OF 8051
-> Reset & Oscillator Circuit of 8051 Micro-Controller
-> Program Status Word-(PSW) of 8051
-> Internal RAM structure of 8051 comtroller
0 comments:
Post a Comment