Lab Manual Part 2 Exp2 - 4
Lab Manual Part 2 Exp2 - 4
DATA TRANSFER/EXCHANGE
AIM: To develop ALPs for 8051 to transfer and exchange a set of data between specified locations.
PROGRAM:
A)DATA TRANSFER
Source location : 08H-0CH, destination location : 40H – 44H, data set = 5 numbers
ORG 0x0000 // program to be stored in memory locations 0x0000 onwards
MOV 08H, #40H // store 5 numbers in the locations from 08H onwards
MOV 09H, #15H
MOV 0AH, #75H
MOV 0BH, #08H
MOV 0CH, #56H
RESULT:
Developed the ALPs for data transfer and exchange operations between specified locations in 8051 using
KEIL IDE simulator and verified.
A) DATA TRANSFER
Input :
Location 08H 09H 0AH 0BH 0CH
Value 40H 15H 75H 08H 56H
Output :
Location 40H 41H 42H 43H 44H
Value 40H 15H 75H 08H 56H
Set2
Location 40H 41H 42H 43H 44H
Value 54H 26H 1CH 9BH 72H
Output :
Set1
Location 08H 09H 0AH 0BH 0CH
Value 54H 26H 1CH 9BH 72H
Set2
Location 40H 41H 42H 43H 44H
Value 40H 15H 75H 08H 56H
EXPERIMENT 3
LARGEST / SMALLEST NUMBER
AIM: To develop ALPs for 8051 to obtain the largest / smallest number from the given data set.
PROGRAM:
A) LARGEST NUMBER
Numbers in data set : 6, Data location : 15H – 1AH
B) SMALLEST NUMBER
Numbers in data set : 6, Data location : 15H – 1AH
RESULT:
Developed the ALPs for obtaining the largest and smallest number from the given data set in 8051 using
KEIL IDE simulator and verified.
A) LARGEST NUMBER
Input :
Location 15H 16H 17H 18H 19H 1AH
Value 18H 40H 30H 15H 08H 56H
Output :
Location 30H
Value 56H
B) SMALLEST NUMBER
Input :
Location 15H 16H 17H 18H 19H 1AH
Value 18H 40H 30H 15H 08H 56H
Output :
Location 30H
Value 08H
EXPERIMENT 4
ASCENDING / DESCENDING ORDER
AIM: To develop an ALP for 8051 to sort the numbers in ascending / descending order.
PROGRAM:
A) ASCENDING ORDER
Numbers in data set : 5, Data location : 15H – 19H
DJNZ R2, LOOP1 // if count is not zero, repeat LOOP1 for the next pass
HERE: SJMP HERE
END
B) DESCENDING ORDER
DJNZ R2, LOOP1 // if count is not zero, repeat LOOP1 for the next pass
HERE: SJMP HERE
END
RESULT:
Developed the ALPs for sorting the given set of numbers in ascending and descending order in 8051 using
KEIL IDE simulator and verified.
A) ASCENDING ORDER
Input :
Location 15H 16H 17H 18H 19H
Value 40H 15H 75H 08H 56H
Output :
Location 15H 16H 17H 18H 19H
Value 08H 15H 40H 56H 75H
B) DESCENDING ORDER
Input :
Location 15H 16H 17H 18H 19H
Value 40H 15H 75H 08H 56H
Output :
Location 15H 16H 17H 18H 19H
Value 75H 56H 40H 15H 08H