This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

using 2nd DPTR in DS87C520

Hi
I want to use the second data pointer available in Dallas, since i am reading my port and then immediatly writing this data to external ram.All this has to be done in ISR in 10us. I am using in line assembly but the code is not working when i use both data pointers.

void external0(void) interrupt 0 using 1
{

//TRACK1[LEN_TRK1++]=XBYTE[0x8000]; //TRACK1[LEN_TRK1++] = XBYTE[0x8001];

//The above two C statements are replaced by the below mentioned Assembly code

#pragma ASM
SETB DPS ; DPS=1 ACTIVE DPTR1
MOV DPTR,#08000H
MOVX A,@DPTR ; READ
INC DPTR

CLR DPS ; DPS=0 ACTIVE DPTR0
MOV DPL,LEN_TRK1+01H
MOV DPH,LEN_TRK1
MOVX @DPTR,A ; WRITE
INC DPTR

SETB DPS ; DPS=1 ACTIVE DPTR1
MOVX A,@DPTR ; READ
CLR DPS ; DPS=0 ACTIVE DPTR0
MOVX @DPTR,A ; WRITE
INC DPTR
MOV LEN_TRK1+01H,DPL
MOV LEN_TRK1,DPH
#pragma ENDASM
}

Thanx
Faisal

Parents
  • Yep. With only 2 data pointers, you can get into a lot of crazy situations saving and restoring both data pointers.

    The infineon 515 has 8 data pointers so you have 2 that are available for each register bank. That kinda makes things better.

    However, the best utilization of dual data pointers is for moving memory like you would do with memmove, memcpy, and so on.

    Jon

Reply
  • Yep. With only 2 data pointers, you can get into a lot of crazy situations saving and restoring both data pointers.

    The infineon 515 has 8 data pointers so you have 2 that are available for each register bank. That kinda makes things better.

    However, the best utilization of dual data pointers is for moving memory like you would do with memmove, memcpy, and so on.

    Jon

Children
No data