关于51扩展RAM/IO的问题
最近用51扩展RAM/IO时老访问不到外部扩展的RAM,用的是8155
8155_IO/\M---->P2.5
8155_\CE------>P2.4
所以扩展RAM的地址是0XCFXX
AT89C51ED2中的EXTRAM的描叙
EXTRAM
EXTRAM bit
Cleared to access internal XRAM using movx @ Ri/ @ DPTR.
Set to access external memory.
Programmed by hardware after Power-up regarding Hardware Security Byte (HSB),
default setting, XRAM selected.
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<math.h>#include<absacc.h>#include<intrins.h>#include "REGAT89C51ED2.H"#define ramtest XBYTE[0XCF02].....main() { unsigned char xdata * data pstr; int i=0; int j=0; int t=0; unsigned char test; P0=P1=P2=P3=0xff;//测试P0,P2口读写正常 P2=0; _nop_(); P2=0x55; _nop_(); P2=0xaa; long_delay(10); // rst=0; AUXR|=0x02;//选择片外的XRAM //test----- ramtest=0xaa; i=ramtest; ramtest++; j=ramtest; pstr=0xcf02; test=*pstr; *pstr=0x55; test=*pstr+1;