Saturday, April 30, 2016

8051 Program – external ram to internal ram


; copy data from external ram to internal ram
ORG 0H
IRAM_ADDR EQU 40H
ERAM_ADDR EQU 0000H
BYTE_COUNT EQU 10
MAIN :
MOV DPTR,#ERAM_ADDR
MOV R7,#BYTE_COUNT
MOV A, #0
memfill:MOVX @DPTR,A
INC A
INC DPTR
DJNZ R7,memfill
MOV R0,#IRAM_ADDR
MOV DPTR, #ERAM_ADDR
MOV R7,#BYTE_COUNT
LCALL COPY
SJMP MAIN
COPY:
MOV A, #0
loop: MOVX A, @DPTR
MOV @R0, A
INC R0
INC DPTR
DJNZ R7, loop
RET
END



Related topics:
8051 Program - clear register banks   |   8051 Program - clear bit memory   |   8051 Program - clear stack memory   |   8051 Program - rom to ram   |   8051 Program - internal ram to external ram   |   8051 Program - ram to ram   |   8051 Program - memory subroutines   |   8051 Program - math subroutines   |   8051 Program - conversion subroutines

List of topics: 8051

No comments:

Post a Comment