You are on page 1of 1

1.

Assume that 3 BCD numbers are stored in RAM location starting at


40H, as shown in the table below. Write a program to find the sum
of all the numbers and ensure that the answer is in BCD. Store the
final answer in R5. Observe your addressing methods. (15)

Register value
55 20
57 42
59 5

2. Write a programs that can perform the following arithmetic and


logic operations:
a) Add values 54H, 12H and 14H. Store the lower byte of the
answer in address 40H and the higher byte in address 41H.
(5)
b) Perform AND operation between AAH and 55H and complement the
answer. Store the answer in address 40H. (3)
c) Perform XOR operation between AAH and 55H and complement the
answer. Store the answer in address 41H. (2)

3. Write a subroutine program to generate a delay of 400ms. Assume


the 8051 is using an XTAL of 10MHz. Show clearly how the delay was
calculated. (13)

4. Write a program to store a value 20H in addresses 30-35. Use a


conditional jump and indirect addressing mode to store the value
in the addresses. (7)

5. Analyse the assembly program and find the time delay for the Delay
subroutine shown in the figure below if the system has 8051 with
XTAL of 13MHz. Consider the overhead generated by loops repetition.
(7)
ORG 30H
Delay: MOV R5, #5
Back: MOV R4, #55
Again: MOV R3, #155
Here: NOP
NOP
DJNZ R3, Here
DJNZ R4, Again
DJNZ R5, Back
RET

You might also like