Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/23/03 02:01
Read: times


 
#43967 - RE: AT89S8252 DPTR
Responding to: ???'s previous message
Here is the relevant code from Philips Application Note AN468 on dual DPTR usage:

; Block move using dual data pointers
; Destroys DPTR0, DPTR1, A and PSW
; note: DPS exits opposite of entry state
; unless an extra INC AUXR1 is added
;
00A2 AUXR1 EQU 0A2H
;
0000 909000 MOV DPTR,#SOURCE ; address of SOURCE
0003 05A2 INC AUXR1 ; switch data pointers
0005 90A000 MOV DPTR,#DEST ; address of DEST
0008 LOOP:
0008 05A2 INC AUXR1 ; switch data pointers
000A E0 MOVX A,@DPTR ; get a byte from SOURCE
000B A3 INC DPTR ; increment SOURCE address
000C 05A2 INC AUXR1 ; switch data pointers
000E F0 MOVX @DPTR,A ; write the byte to DEST
000F A3 INC DPTR ; increment DEST address
0010 70F6 JNZ LOOP ; check for 0 terminator
0012 05A2 INC AUXR1 ; (optional) restore DPS

In certain situations (such as fault recovery or interrupts) toggling DPS may not be sufficient and DPS must be set
to a known value without depending on the current state.
53A27E ANL AUXR1,#7EH ; DPS=0
43A201 ORL AUXR1,#1 ; DPS=1

Hope the above helps.

Raghu

List of 3 messages in thread
TopicAuthorDate
AT89S8252 DPTR            01/01/70 00:00      
   RE: AT89S8252 DPTR            01/01/70 00:00      
   RE: AT89S8252 DPTR            01/01/70 00:00      

Back to Subject List