C8051F外部存储器读写

本质是movx指令,可用_AT_,XBYTE (absacc.h)控制读写。 


//外部xram写

void xram_write(unsigned int addr, char byte)
{
   char xdata * data pwrite;           // write pointer


   pwrite = (char xdata *) addr;       // initialize write pointer
   


   *pwrite = byte;                     // write the byte


}


//外部xram读
char xram_read(unsigned int addr)
{
   char xdata * data pread;           // read pointer


   pread = (char xdata *) addr;       // initialize read pointer
   


   return *pread;                     // read the byte


}

你可能感兴趣的:(C8051F外部存储器读写)