Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

2. Write a segment of code to do the following: Copy data from register R4 of ba

ID: 3588589 • Letter: 2

Question

2. Write a segment of code to do the following: Copy data from register R4 of bank3 into registerR1 of bank1. Save the value 25H in the accumulator then copy it into location 12H of the external RAM. Add the content of R5 in bank3 to the value stored in a memory location with an address saved in R3 of the same bank. Copy the content of a code memory location 22H to register B. Save the value 33H into the external RAM location 60H. Exchange the value stored in the accumulator with the value stored in R1. A. B. C. D. E. F.

Explanation / Answer

A) MOV A, 1Ch

MOV 09h ,A

UsingAccumulator as intermediate .

Explaination-

The 8051 hastotal of 128 bytes of Ram. This 128 bytes is divided into 3 parts . where one of the part is of 32 byte and is used for register and stack and are addressed as 00 to 1f hex. Now this 32 bytes are again divided into 4 banks and each bank has 8 registers R0-R7

Representation

Register. Bank 0. Bank 1. Bank 2. Bank 3

R0. 00H. 08H. 10H. 18H

R1. 01H. 09H. 11H. 19H

R2. 02H. 0AH. 12H. 1AH

R3. 03H. 0BH. 13H. 1BH

R4. 04 H 0CH. 14H. 1CH

R5. 05 H. 0DH. 15H. 1DH

R6. 06H. 0EH. 16H. 1EH

R7. 07H. 0FH. 17H. 1FH

B) MOV A , #25H (loadvalue 25H into acculator)

MOV 12H , A ( copy it into 12H location)

C) MOV A,1Dh ( MOV value stored in register 5 of bank 3 into accumulator)

Add A, @1Bh (add value of accumulator and value addresed by pointer present in1Bh register )

D) MOV Bh,22h

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote