Logical Group in 8051


In 8051 Microcontroller there is 25 different instructions under the Logical Group. In total there are 49 opcodes. The Carry Flag (CY) affects only by instruction RRC and RLC.

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
ExecutionTime
Opcode Count
ANL A, Rn
1
1
8
ANL A, a8
2
1
1
ANL A, @Ri
1
1
2
ANL A, #d8
2
1
1
ANL a8, A
2
1
1
ANL a8, #d8
3
2
1
ORL A, Rn
1
1
8
ORL A, a8
2
1
1
ORL A, @Ri
1
1
2
ORL A, #d8
2
1
1
ORL a8, A
2
1
1
ORL a8, #d8
3
2
1
XRL A, Rn
1
1
8
XRL A, a8
2
1
1
XRL A, @Ri
1
1
2
XRL A, #d8
2
1
1
XRL a8, A
2
1
1
XRL a8, #d8
3
2
1
CLR A
1
1
1
CPL A
1
1
1
RL A
1
1
1
RLC A
1
1
1
RR A
1
1
1
RRC A
1
1
1
SWAP A
1
1
1


Examples

Sr.NoInstruction & Description
1
ANL A, R5
This is an example of type ANL A, Rn. In this instruction, the content of R5 will be ANDed with register A and store the result into A. Similarly the OR (ORL A, Rn) and Ex-OR(XRL A, Rn) also works.
2CLR A
It is clear instruction. Using this instruction the content of register A will be 00H. We cannot clear other registers content by using this instruction.
3CPL A
This instruction is used to complement each bit of register A. This instruction also cannot complement other registers data.
4RL A
This instruction is used for rotating the A register to the Left. This is equivalent to the RLC instruction of 8085. No flags are affected by this instruction.
5RLC A
This is similar to the RL A instruction, but it rotates through the Carrying flag. The RAL instruction of 8085 is similar to this instruction. By this instruction only carry flag is affected.
6RR A
This instruction can perform the reverse operation of RL A instruction. It rotates the A register content to the right. In 8085, the equivalent instruction was RRC.
7RRC A
This is Rotate Right through carrying. It affects the Carry Flag only. The equivalent instruction of this in 8085 was RAR.
8SWAP A
This instruction is used to swap LS Hex digit and MS Hex digits. This instruction is functionally same as executing RL A/RR A four times


Updated on: 27-Jun-2020

5K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements