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|
|Sr.No||Instruction & 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.
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.
This instruction is used to complement each bit of register A. This instruction also cannot complement other registers data.
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.
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.
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.
This is Rotate Right through carrying. It affects the Carry Flag only. The equivalent instruction of this in 8085 was RAR.
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