![Nuvoton NuMicro MS51 32K Series Скачать руководство пользователя страница 465](http://html1.mh-extra.com/html/nuvoton/numicro-ms51-32k-series/numicro-ms51-32k-series_technical-reference-manual_1720303465.webp)
MS51
Nov. 28, 2019
Page
465
of 491
Rev 1.00
MS51
32K
SE
RIES
TE
CHNICAL RE
F
EREN
CE MA
N
UAL
6.14 Auxiliary Features
6.14.1
Dual DPTRs
The original 8051 contains one DPTR (data pointer) only. With single DPTR, it is difficult to move data
form one address to another with wasting code size and low performance. The MS51 provides two
data pointers. Thus, software can load both a source and a destination address when doing a block
move. Once loading, the software simply switches between DPTR and DPTR1 by the active data
pointer selection DPS (AUXR0.0) bit.
An example of 64 bytes block move with dual DPTRs is illustrated below. By giving source and
destination addresses in data pointers and activating cyclic makes block RAM data move more simple
and efficient than only one DPTR. The
INC AUXR1
instruction is the shortest (2 bytes) instruction to
accomplish DPTR toggling rather than
ORL
or
ANL
. For AUXR0.1 contains a hard-wired 0, it allows
toggling of the DPS bit by incrementing AUXR1 without interfering with other bits in the register.
MOV
R0,#64
;number of bytes to move
MOV
DPTR,#D_Addr
;load destination address
INC
AUXR0
;change active DPTR
MOV
DPTR,#S_Addr
;load source address
LOOP:
MOVX A,@DPTR
;read source data byte
INC
AUXR0
;change DPTR to destination
MOVX @DPTR,A
;write data to destination
INC
DPTR
;next destination address
INC
AUXR0
;change DPTR to source
INC
DPTR
;next source address
DJNZ R0,LOOP
INC
AUXR0
;(optional) restore DPS
AUXR1 also contains a general purpose flag GF2 in its bit 3 that can be set or cleared by the user via
software.