Bit-processing group in 8051


In 8051 Microcontroller there is 17 different instructions under the Logical Group. In total there are 17 opcodes. The Carry Flag (CY) acts like the single-bit accumulator in different bit processing instructions.

In the following table, we will see the Mnemonics, Lengths, Execution Time in terms of the machine cycle, Number of Opcodes etc.

Mnemonics
Byte Count
Execution Time
Opcode Count
CLR C
1
1
1
CLR bit
2
1
1
SETB C
1
1
1
SETB bit
2
1
1
CPL C
1
1
1
CPL bit
2
1
1
ANL C, bit
2
2
1
ANL C, /bit
2
2
1
ORL C, bit
2
2
1
ORL C, /bit
2
2
1
MOV C, bit
2
1
1
MOV bit, C
2
2
1
JC rel
2
2
1
JNC rel
2
2
1
JB bit, rel
3
2
1
JNB bit, rel
3
2
1
JBC bit, rel
3
2
1


Examples

Sr.No Instruction & Description
1CLR C
This instruction is used to clear the carry flag to 0.
2SETB 0D5H
This instruction of type SETB bit. It sets to 1bit. Here the bit is D5 (which is the F0 pin of PSW). This instruction can also be written like this SETB PSW.5 or SETB F0.
3CPL C
It complements the content of Carry Flag
4ANL C, 07
Using this instruction, it ANDs the C-bit with bit 7. (Here 7 indicates the MS bit in internal RAM location20H.)
5ORL C, /07
This instruction ORs the C-bit with the complement of bit 7.
6MOV C, 05
This instruction will move the content of bit 5to carry.
7JC LABEL
This is a jump instruction. When the Carry flag is 1, it will jump to the LABEL.
8JNB 80H, LABEL
By this instruction, when LS bit of Port 0 is low, then it jumps to the LABEL.
9JBC 80H, LABEL
The JBC stands for Jump if the bit is set, then clear the bit. When LS bit of port P0 is high, it humps to the location pointed by LABEL.


Updated on: 27-Jun-2020

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements