0% found this document useful (0 votes)
20 views4 pages

Exp 1 MPMC

The document contains two assembly language lab experiments for adding unsigned 8-bit numbers using the 8051 microcontroller. The first experiment adds values in registers A and B, storing the result in memory location 52h, while the second experiment adds values from memory locations 30h and 31h, storing the result in 40h and handling any carry in 41h. Both experiments demonstrate arithmetic operations and memory interactions in assembly language.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views4 pages

Exp 1 MPMC

The document contains two assembly language lab experiments for adding unsigned 8-bit numbers using the 8051 microcontroller. The first experiment adds values in registers A and B, storing the result in memory location 52h, while the second experiment adds values from memory locations 30h and 31h, storing the result in 40h and handling any carry in 41h. Both experiments demonstrate arithmetic operations and memory interactions in assembly language.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Microprocessor and Microcontroller LAB Experiment 1

Name: Khushi Singh


Admission No.: U22EE027
Sub.: MPMC Lab
Exp No.: 1.1

AIM: Write an assembly language program to add two unsigned 8-bit numbers stored in registers A
and B, respectively. Store the result at memory location 52h.
SOFTWARE USED: Keil mVision5

HARDWARE REQUIRED: NA
ALGORITHM:
1. Start the program execution at memory location 0000h (denoted by ORG 0000h).
2. Load the hexadecimal value 57h into the accumulator (A register).
3. Load the hexadecimal value 6Ah into register B.
4. Add the contents of register B to the accumulator (A) and store the result in the accumulator
(A).
5. Move the result from the accumulator (A) to the external RAM memory location 52h.
6. Terminate the program execution (END).
CODE:
org 0000h
MOV A, #57h
MOV B, #6Ah
ADD A, B
MOV 52h, A
END

OUTPUT:

Before Code execution

1|Page
Admission No.: U22EE027
Microprocessor and Microcontroller LAB Experiment 1

After Code Execution

CONCLUSION:

The program adds two unsigned 8-bit numbers stored in registers A and B using the ADD instruction.
The sum is stored at memory location 52H. This demonstrates the 8051 microcontroller's ability to
perform arithmetic operations efficiently. It also highlights the interaction between registers and
memory in assembly language.

2|Page
Admission No.: U22EE027
Microprocessor and Microcontroller LAB Experiment 1

Name: Tanisha Pandey


Admission No.: U22EE011
Sub.: MPMC Lab
Exp No.: 1.2

AIM: Write an assembly language program to add two unsigned 8-bit numbers stored in internal
memory locations 30H and 31H and store the final result in memory locations 40H and 41H,
respectively. Data at 30H and 31H are DF and DE, respectively.
SOFTWARE USED: Keil mVision5

HARDWARE REQUIRED: NA
ALGORITHM:
1. The program begins at memory location 0000h (denoted by ORG 0000h).
2. Load the 8-bit number stored at memory location 30h into register A.
3. Load the 8-bit number stored at memory location 31h into register B.
4. Add the values in registers A and B using the ADD instruction. The result is stored in register
A.
5. Store the result of the addition (lower byte) in a memory location for 40 hours.
6. If no carry (carry flag is clear), jump to loc1 and proceed.
7. If there is a carry (carry flag is set), proceed to the next step.
8. If there is a carry, move the value 01h into memory location 41h to indicate the carry.
9. The program ends after handling the carry (if any) and storing the result in 40h and 41h.

CODE:
org 0000h
MOV A, 30h
MOV B, 31h
ADD A, B
MOV 40h, A
JNC loc1
MOV 41h, #01h
loc1:
END

3|Page
Admission No.: U22EE027
Microprocessor and Microcontroller LAB Experiment 1

OUTPUT:

Before Code Execution

After Code Execution

CONCLUSION:

The program adds two unsigned 8-bit numbers stored in 30h and 31h memory locations. The result is
stored in 40h, and if there is a carry, 01h is stored in 41h. It demonstrates handling basic arithmetic
and carry operations in 8051 assembly. The program efficiently manages the carry flag to ensure
accurate results.

4|Page
Admission No.: U22EE027

You might also like