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
  • Looking at your assembly code you are using the statements clr dps & setb dps but the dps register is a byte not a bit.

    As far as I recall the DPS register is not bit addressable so you cannot set and clear the SEL bit within it directly.

    Dallas recommended using the inc dps instruction to flip back and forth between the dptrs. Of course you have to start by initialising it to a known value.

Reply
  • Looking at your assembly code you are using the statements clr dps & setb dps but the dps register is a byte not a bit.

    As far as I recall the DPS register is not bit addressable so you cannot set and clear the SEL bit within it directly.

    Dallas recommended using the inc dps instruction to flip back and forth between the dptrs. Of course you have to start by initialising it to a known value.

Children