0% found this document useful (0 votes)
42 views

8051 Arithmetic operations

The document outlines an experiment for programming arithmetic operations using the 8051 microcontroller, including addition, subtraction, multiplication, and division of two 8-bit data. It provides the necessary software/hardware requirements, algorithms, flowcharts, and assembly language programs for each operation. The document includes memory addresses, opcodes, and comments for clarity on the programming process.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views

8051 Arithmetic operations

The document outlines an experiment for programming arithmetic operations using the 8051 microcontroller, including addition, subtraction, multiplication, and division of two 8-bit data. It provides the necessary software/hardware requirements, algorithms, flowcharts, and assembly language programs for each operation. The document includes memory addresses, opcodes, and comments for clarity on the programming process.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

ET3491 Embedded Systems and IoT Design

EXP.NO: PROGRAMMING ARITHMETIC OPERATIONS IN 8051


DATE:

AIM
To write an assembly language program to perform arithmetic operation of two 8
bit data using 8051 microcontroller.

SOFTWARE/HARDWARE REQUIRED
 8051 Microcontroller kit

ALGORITHM

Addition of two 8 bit data Subtraction of two 8 bit data

Multiplication of two 8 bit data Division of two 8 bit data

TPGIT/ECE Page No:


ET3491 Embedded Systems and IoT Design

FLOWCHART

Addition of two 8 bit data Subtraction of two 8 bit data

Multiplication of two 8 bit data Division of two 8 bit data

TPGIT/ECE Page No:


ET3491 Embedded Systems and IoT Design

PROGRAM
Addition of two 8 bit data
Memory Opcode Label Mnemonics Comments
address
4100 MOV A, #data1 Move the 8 bit data to accumulator

4102 ADD A, #data2 Add the content of accumulator with the 8bit
data.
4104 MOV DPTR,#4500 Move the 16 bit address to data pointer.

4107 MOVX@DPTR,A Move the content of accumulator to theaddress


specified by data pointer.
4108 SJMP 4108 Terminate the program

Input: Output:

Address Data Address Data

Subtraction of two 8 bit data

Memory
address Opcode Label Mnemonics Comments

4100 MOV A, #data1 Move the first input data to acc.


Subtract the second input data from acc and
4102 SUBB A, #data2 store in acc.
The address 4500H is moved to data
4104 MOV DPTR,#4500 pointer.

Move the content of acc to the address


4107 MOVX @DPTR,A specified by data pointer.

4108 SJMP 4208 Short jump.

Input Output

Address Data Address Data

TPGIT/ECE Page No:


ET3491 Embedded Systems and IoT Design

TPGIT/ECE Page No:


ET3491 Embedded Systems and IoT Design

Multiplication of two 8 bit data


Memory Opcode La Mnemonics Comments
address bel
4100 MOV A, #data1 Move the first input data to acc.
4102 MOV B, #data2 Move the second input data to B reg.
4105 MUL AB Multiply the content of acc with B reg
and store it in acc.
4106 MOV DPTR,#4500 Move the address 4500H to data pointer.
4109 MOVX @DPTR,A Move the content of acc (lower byte product)
to the address
specified by data pointer
410A INC DPTR Increment data pointer.
410B MOV A,B Move the content of B reg (higher byte
product) to acc.
410D MOVX @DPTR,A Move the content of acc to the address
specified by data pointer
410E SJMP 420E Short jump.
Input: Output:

Address Data Address Data

Division of two 8 bit data


Memory Opcode Label Mnemonics Comments
address
4100 MOV A, #data1 Move the first input data to acc.
4102 MOV B, #data2 Move the second input data to B reg.
4105 DIV AB Divide the content of acc with B reg and
store it in acc.
4106 MOV DPTR,#4500 Move the address 4500H to data pointer.
4109 MOVX @DPTR,A Move the content of acc to the address
specified by data pointer (quotient)
410A INC DPTR Increment data pointer.
410B MOV A,B Move the content of B reg to acc. (remainder)
410D MOVX @DPTR,A Move the content of acc to the address
specified by data pointer
410E SJMP 420E Short jump.
Input: Output:

Address Data Address Data

RESULT

TPGIT/ECE Page No:


ET3491 Embedded Systems and IoT Design

TPGIT/ECE Page No:

You might also like