This is for 8051 Assembly language ONLY Write a program for

This is for 8051 Assembly language ONLY.

Write a program for 8051 that reserves a memory space (10H-20H) of 16_D bytes and initializes it with the hex number: A_H. The program should copy the 16D bytes of data into another memory location 30H-40_H using MOV instruction. Verify the program using MIDE-51.

Solution

Here we have to transfer 16 data bytes from 10-20h to 30-40h to external RAM.
So first, we need one counter.
Then we need two pointers one for source second for destination.

  
Mov r7, #0Ah ; initialize counter by 10d
Mov r0, 10h ; get initial source location
Mov dptr, #30h ; get initial destination location
Nxt: Mov a, @r0 ; get first content in acc
Movx @dptr, a ; move it to external location
Inc r0 ; increment source location
Inc dptr ; increase destination location
Djnz r7, nxt

This is for 8051 Assembly language ONLY. Write a program for 8051 that reserves a memory space (10H-20H) of 16_D bytes and initializes it with the hex number: A

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site