Data copy program (ASM) of MCS51 microcontroller
;Internal RAM data copy program
; Entry: R0, R7
; Occupied resources: A
; Stack requirement: 2 bytes
; Exit: R1
IBMOV :MOV A,R0
ADD A,R7
MOV R0,A
MOV A,R1
ADD A,R7
MOV R1,A
IBM1 :DEC R0
DEC R1
MOV A,@R0
MOV @R1,A
DJNZ R7,IBM1
RET
;External RAM data copy program
; Entry: ADDPH, ADDPL, R7
; Occupied resources: ACC
; Stack requirement: 2 bytes
; Exits: R0, R1
EBMOV1 :MOV A,ADDPL
ADD A,R7
MOV DPL,A
CLR A
ADDC A,ADDPH
MOV DPH,A
MOV A,R7
ADD A,R1
XCH A,R0
ADDC A,#00H
MOV P2,A
EBM11 :DEC R0
CJNE R0,#0FFH,EBM12
DEC P2
EBM12 :DEC DPL
MOV A,DPL
CJNE A,#0FFH,EBM13
DEC DPH
EBM13 :MOVX A,@R0
MOVX @DPTR,A
DJNZ R7,EBM11
RET
;External RAM data copy program
; Entry: ADDPH, ADDPL, R6, R7
; Occupied resources: ACC
; Stack requirement: 2 bytes
; Exit: R0, R1
EBMOV2 :MOV A,ADDPL
ADD A,R7
MOV DPL,A
MOV A,R6
ADDC A,ADDPH
MOV DPH,A
MOV A,R7
ADD A,R1
XCH A,R0
ADDC A,R6
MOV P2,A
MOV A,R7
JZ EBM21
INC R6
EBM21 :DEC R0
CJNE R0,#0FFH,EBM22
DEC P2
EBM22 :DEC DPL
MOV A,DPL
CJNE A,#0FFH,EBM23
DEC DPH
EBM23 :MOVX A,@R0
MOVX @DPTR,A
DJNZ R7,EBM21
DJNZ R6,EBM21
RET
;Copy external RAM data to internal RAM program
; Entry: ADDPH, ADDPL, R7
; Occupied resources: ACC
; Stack requirement: 2 bytes
; Exit: R0
ITEMOV :MOV A,ADDPL
ADD A,R7
MOV DPL,A
MOV A,ADDPH
ADDC A,#00H
MOV DPH,A
MOV A,R0
ADD A,R7
MOV R0,A
ITEM1 :DEC R0
DEC DPL
MOV A,DPL
CJNE A,#0FFH,ITEM2
DEC DPH
ITEM2 :MOVX A,@DPTR
MOV @R0,A
DJNZ R7,ITEM1
RET
Previous article:Analysis on the method of realizing PWM output function in MCS-51 series microcontroller
Next article:MCS-51 microcontroller driver based on K9F5608A
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- How haptic technology can enhance driving safety
- Let’s talk about the “Three Musketeers” of radar in autonomous driving
- Why software-defined vehicles transform cars from tools into living spaces
- How Lucid is overtaking Tesla with smaller motors
- Wi-Fi 8 specification is on the way: 2.4/5/6GHz triple-band operation
- Wi-Fi 8 specification is on the way: 2.4/5/6GHz triple-band operation
- Vietnam's chip packaging and testing business is growing, and supply-side fragmentation is splitting the market
- Vietnam's chip packaging and testing business is growing, and supply-side fragmentation is splitting the market
- Three steps to govern hybrid multicloud environments
- Three steps to govern hybrid multicloud environments
- 【Qinheng Trial】Four overall system designs (1/2)——Function integration of ch549 modules
- Share: Solution to BQ40Z80's constant hiccups
- Altium Designer v21.2.0.30
- Pre-registration for the celebrity live show | Arrow-ADI multi-parameter optical water quality analysis platform
- LM2575, DC24V to DC12V, there is a howling sound during debugging?
- Raspberry Pi high-resolution square display PIMORONI HYPERPIXEL 4.0 SQUARES
- Easy-to-use nine-channel RGB LED driver
- [Application development based on NUCLEO-F746ZG motor] 10. Parameter configuration - GPIO port configuration
- Magnetic Hall Sensor Omnipolar MH251
- Flexible vibration plate machine operation demonstration diagram