ET3491 Embedded Systems and IoT Design
EXP.NO:
PROGRAMMING LOGICAL OPERATIONS IN 8051
DATE:
AIM
To write an assembly language program to perform logical operations of two 8 bit
data using 8051 microcontroller.
SOFTWARE/HARDWARE REQUIRED
➢ 8051 Microcontroller kit.
ALGORITHM
Logical OR Operation
Logical AND Operation
1’s and 2’s Complement
TPGIT/ECE Page No:
ET3491 Embedded Systems and IoT Design
FLOWCHART
TPGIT/ECE Page No:
ET3491 Embedded Systems and IoT Design
PROGRAM
Logical OR Operation
Memory Opcod Label Mnemonics Comments
address e
4100 MOV A, #data1 Move data1 to A register
4102 MOV A, #data2 Move data2 to B register
4105 ORL A, B ORL A with B
4107 MOV DPTR, #4150 Move the address 4150 to DPTR
410A MOVX @DPTR,A Store result in DPTR address
410B L1 SJMP L1 (410B) Stop the program
Input Output
Address Data
Address Data
Logical AND Operation
Memory
address Opcode Label Mnemonics Comments
4100 MOV A, #data1 Move data1 to A register
4102 MOV A, #data2 Move data2 to B register
4105 ANL A, B ANL A with B
4107 MOV DPTR, #4150 Move the address 4150 to DPTR
410A MOVX @DPTR,A Store result in DPTR address
410B L1 SJMP L1 (410B) Stop the program
Input:
Address Data
TPGIT/ECE Page No:
ET3491 Embedded Systems and IoT Design
TPGIT/ECE Page No:
ET3491 Embedded Systems and IoT Design
Output:
Address Data
1’s and 2’s Complement
Memory
address Opcode Label Mnemonics Comments
4100 MOV A, #data Move the 8 bit data to accumulator.
4102 CPL A Complement the content of accumulator.
4103 MOV DPTR,#4500H Move the 16 bit address to data pointer.
4106 MOVX @DPTR,A Move the content of accumulator to the
address specified by data pointer.
4107 INC DPTR Increment data pointer.
4108 INC A Increment the content of accumulator.
4109 MOVX @DPTR,A Move the content of accumulator to the
adr specified by data pointer.
410A SJMP Short jump.
Input:
Address Data
Output:
Address Data
RESULT
TPGIT/ECE Page No:
ET3491 Embedded Systems and IoT Design
TPGIT/ECE Page No: