Professional Documents
Culture Documents
Lab Record Task 1
Lab Record Task 1
: 1
School of Electronics Engineering
VIT, Vellore
Reg.No 19BEC0365
L41+L42
Course Code ECE3003 Slot & Semester
FALL ~ 2020-21
Date of
Date of Exp. 22-02-2021 25-02-2021
Submission
Faculty A.Karthikeyan
Reg no: 19BEC0365 Fall 2019-20 ECE3003 - 𝜇C and its applications
Question
1. Write and assemble a program to add the following data and then use the simulator
to examine the CY flag. INPUT DATA REG NO: Example 01 7B EC 02 75. Five max
8BIT NUMBERS (FF ,FF,FF,FF,FF)
2. Write and assemble a program to load values into each of registers R0 - R4 and then
push each of these registers onto the stack. Single-step the program, and examine
the stack and the SP register after the execution of each instruction.
4. Write and assemble a program to load values into each of registers R0 - R4 and
then push each of these registers onto the stack and pop them back. Single-step the
program, and examine the stack and the SP register after the execution of each
instruction.
5.Write a program to add 10 bytes of BCD data and store the result in R2 and R3.
The bytes are stored in ROM space starting at 300H.
EX: 22H,43H,23H,34H,31H,77H,91H,33H,43H,07H
Notice that you must first bring the data from ROM space into the CPU's RAM,
then add them together. Use a simulator to single-step the program and examine the
data.
Question 1:
Aim: To write an 8051 ALP to perform addition of 5 8BIT NUMBERS using keil software
and to verify the result manually.
Tools Required- Keil Software
Algorithm:
1. Decide the numbers to be added- 01 9B EC 03 65
2. Assign the first two numbers to A and B
3. Add the first two numbers using ADD and store in A
4. Shift contents of A to B
5. Assign the next number to A and repeat the process again
6. Repeat the same till all the numbers are added
Program:
L4 END
Manual Calculation:
BINARY DECIMAL
01 01 Decimal Addition:
01+155+236+03+101 = 496
9B 155
Decimal to Hexadecimal:
EC 236 (496)10 = (1F0)16
03 03
65 101
Inferences:
1. There is a carry
Result: The 8051 ALP to perform addition of 5 8BIT NUMBERS is executed using keil
software and the results are verified manually
Question 2:
Aim: To get values and load them to register and push them onto the stack.
Tools Required- Keil Software
Algorithm:
1. Decide the numbers to be loaded- 05 15 25 35 45
2. Assign the values to registers R0 to R4
3. Push each value into the stack
SENSE, VIT Page 7 of 20
Reg no: 19BEC0365 Fall 2019-20 ECE3003 - 𝜇C and its applications
4. Check for execution on the memory window
Program:
END
Inferences:
1. All the data are pushed into the stack
Result: The 8051 ALP to perform PUSH of 5 8BIT NUMBERS is executed using keil software and
the results are verified manually
Question 3:
Aim: To get values and load them to register and pop them out of the stack.
Tools Required- Keil Software
Algorithm:
1. Pop the already fed values out of the stack
Program:
END
Inferences:
1. All the data are popped out of the stack
Result: The 8051 ALP to perform POP of 5 8BIT NUMBERS is executed using keil software and the
results are verified manually
Question 4:
Aim: To get values and load them to register and push them onto the stack.
Tools Required- Keil Software
Algorithm:
1. Decide the numbers to be loaded- 05 15 25 35 45
2. Assign the values to registers R0 to R4
3. Push each value into the stack
4. Pop each value back from the stacks
5. Check for execution on the memory window
Program:
Transfer from
stack
END
Inferences:
1. All the data are pushed into the stack and then popped from it
Question 5:
Aim: Write a program to add 10 bytes of BCD data and store the result in R2 and R3.
The bytes are stored in ROM space starting at 300H.
Tools Required- Keil Software
Algorithm:
1. Take 10 bytes of BCD Data and store in DB
2. Move data pointer to 300
3. Set a loop with 10 counts to:
a. Take the data from DB
b. Add the data to and store it to A
c. Increment the data pointer and register to read the next data value
4. On completion of 10 iterations, the control exits from the loop
5. Short jump (SJMP) is executed to make the control come out of the loop
6. The program then ends
Program:
ORG
register
DA A 1 1 Adjusts C
the 8 bit
value to
BCD
format
(Decimal
Adjust)
ORG
DB
END
Manual Calculation:
Hex 22 43 23 34 31 77 91 33 43 7
Dec 34 67 35 52 49 119 145 51 67 7
34+67+35+52+49+119+145+51+67+7 = 626
(626)10 = (272)16
Inferences:
1. The data are taken one by one from DB and are added
Result: The 8051 ALP to perform ADDITION of 10 BCD NUMBERS is executed using keil software
and the results are verified manually