Lab Report # 10 The 8051 Microcontroller: EEE342 - Microprocessor Systems and Interfacing Engr. Zubair Khaliq
Lab Report # 10 The 8051 Microcontroller: EEE342 - Microprocessor Systems and Interfacing Engr. Zubair Khaliq
Zubair Khaliq
Lab Report # 10
The 8051 Microcontroller
Name Usama Bin Khalid Reg # FA16-BEE-113
Program:
MOV A, #099H
MOV R0, A
MOV R1, A
MOV R2, A
MOV R3, A
MOV R4, A
MOV R5, A
MOV R6, A
MOV R7, A
RET
END
Task 2:
Write and assemble a program to add all the single digits of your Reg. number and save the
result in R2. Pick 7 random numbers (all single digit) if you do not want to use your Reg.
number. Then use the simulator to single-step the program and examine the registers.
Program:
MOV A, #02H
ADD A, #04H
ADD A, #06H
ADD A, #08H
ADD A, #0AH
ADD A, #0CH
ADD A, #0EH
MOV R2, A
END
Task 3:
Write and assemble a program to move value 25H and 34H to register R5, R7. Then load register
A with 0. Add contents of R5 to A and contents of R7 to A. Then move it to registers R7. Use
the simulator to single-step the program and examine the registers.
Program:
MOV R5, #025H
MOV A, #0H
ADD A, R5
ADD A, R7
MOV R7, A
RET
END
Task 4:
The contents of R0 and A are 25H and 35H, respectively. What will be the content of the
destination register after the execution of each line of the following set of instructions?
ADD A, R0
MOV R0, A
ADD A, R0
ADD A, #07
Program:
MOV A, #25H
ADD A, R0
MOV R0, A
ADD A, R0
ADD A, #07
RET
END