Ex No: 2 DATA TRANSFER BETWEEN REGISTERS AND
Date: MEMORY
Aim:
To perform data transfer between registers and memory using 8051 micro controller.
Algorithm:
Step 1: Load counter with number of bytes to transfer.
Step 2: Load source start address into R1.
Step 3: Load destination start address into R1.
Step 4: Repeat the following until counter becomes zero.
4.1: Move data from source to A.
4.2:Move data from A to destination.
4.3: Increment both R0 and R1.
4.4: Decrement counter.
Flowchart:
Program:
ADDRESS LABEL MNEMONIC COMMENTS
000H MOV R2, #05H Load count 5 into R2
0002H MOV R0, #40H Load source address into R0
0004H MOV R1, #50H Load destination address into R1
0006H LOOP MOV A, @R0 Move data from source into A
0008H MOV @R1, A Move data from A to destination
000AH INC R0 Increment source pointer
000CH INC R1 Increment destination pointer
Decrement counter, repeat if not
000EH DJNZ R2, LOOP
zero
0010H END End of program
Output:
Result:
Thus, the data transfer between registers and memory using 8051 microcontroller was
written, executed and the output was verified successfully.