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

Help with movx @r0,a comman and C51,disable XRAM

Hello i have wrote the above code but i use inline assembly to... is any other better way to get the same result ?
i try to read busy flag from a glcd and switch block


void block(unsigned char cs)
{
    bit busy = 1;
        if(cs == 1)
                cs1=1;
        else
                cs2=1;

         #pragma asm
                mov auxr,#0x0e  ;disable XRAM from 0x00 to 0xff
                mov r0,#check_status
                busy:
                movx a,@r0                      ;read busy flag
                jb acc.7,busy
                mov auxr,#0x0c  ;enable XRAM
         #pragma endasm

          cs1=0;
          cs2=0;
}

thanks a lot

Parents Reply Children
  • thanks Erik
    i think i find it and now your AND make sense .

    When you use variables in XDATA, the compiler loads the DPTR and then uses the MOVX A,@DPTR or MOVX @DPTR,A instructions. The address range is 64K bytes.

    When you use variables in PDATA (which is a 265-byte page of XDATA), the compiler loads the address in R0 or R1 (8-bit register) and uses the MOVX @R0/@R1,A and MOVX A,@R0/@R1 instructions. The address range is 256 bytes.

    cheers