🧲Logic means evaluating the conditions using reasonable thinking and making a decision based on the evaluation
🧲Binary deals with data that takes only two discrete values as true or false
🧲Three basic logical operations AND ,OR and NOT operator.
🧲8051 supports logical operations such as AND,OR ,EX-OR and NOT
🧲These operations can be performed on a byte or bit at a time.
✏️BYTE OPERATIONS
👉Operation specified in an instruction is performed on all 8 bits in a BYTE.
👉General format for these instruction are:
ANL destination, source
ORL destination, source
XRL destination, source
✏️AND OPERATION
👉AND instruction for different addressing modes:
ANL A, #data
ANL A, #10H
ANL A, Rn
ANL A, R0
ANL A, @Ri
ANL, @R1
ANL A, direct
ANL A, 20H
✏️OR OPERATION
ORL A, #data
ORL A,#10H
ORL A, Rn
ORL A, R0
ORL A, @Ri
ORL A, @R1
ORL A, direct
ORL A, 20H
ORL direct, #data
ORL 30H, #0E6H
ORL direct, A
ORL 10H, A
✏️EX-OR OPERATION
XRL A, #data
XRL A, #10H
XRL A, Rn
XRL A,R0
XRL A, @Ri
XRL A, @R1
XRL A, direct
XRL A, 20H
XRL direct, #data
XRL 30H, #0E6H
XRL direct, A
XRL 10H, A
✏️UNARY OPERATION
1.Clear: used to clear the contents of accumulation
CLR A //Clear accumulator
2. Complement(NOT operation): used the generation 1’s complement of the data in an accumulator
CPL A//Complement A
3.Rotate:
Rotate accumulator left by one bit
RL A //rotate a one bit position to the left.
Example ,
MOV A, #43H
RL A
RL A
b) Rotate accumulator right by one bit
RR A// Rotate A one bit position to the right
Example,
MOV A, #35H
RR A
C) Rotate accumulator left through carry by one bit
RLC A// Rotate A one bit position to the left through carry flag
Example,
CLR C
MOV A,#0D6H
RLC A
D)Rotate accumulator right through carry by one bit
RRC// Rotate A one bit position to the right through carry flag
Example,
SETB C
MOV A,#62H
RRC A
4. SWAP
It is a instruction which swaps the nibbles of register A.
For example,
A=53H(Before execution)
SWAP A
A=35H(After execution)
No comments:
Post a Comment
If you have any doubts or clarification you need in my blog topics, I would 💯 try to clear it in an efficient manner as possible. I will also accept your suggestions.