另外庫的連接方式是沒有什么問題的,我直接用的keil寫的,直接將庫加進(jìn)來的, ram測試程序在粘貼的時候有點(diǎn)問題, 重發(fā)一次: #include #include #include #include #define uchar unsigned char #define nop() _nop_() unsigned char xdata *add;//這里定義是一定要注意數(shù)據(jù)類型,這里的類型是指地址里的內(nèi)容的數(shù)據(jù)類型 unsigned char temp[30]={0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x40,0x41,0x42,0x43};
void mInitSTDIO( void ) {/* 僅用于調(diào)試用途及顯示內(nèi)容到PC機(jī),與該程序功能完全無關(guān) */ SCON = 0x50; PCON = 0x80; TMOD = 0x20; TH1 = 0xfa; TR1=1; TI=1; /* 9600bps */ } void write() { uchar i; add=0x0000;//數(shù)據(jù)存儲的起始地址 for(i=0;i<14;i++)//連續(xù)存儲14個數(shù)據(jù) { *add=temp[i]; add++; }
} void read() {uchar i,t; add=0x0000; //讀取數(shù)據(jù)的起始地址 for(i=0;i<14;i++)//連續(xù)讀取14個數(shù)據(jù) { t=*add; add++; printf("Read Data is %x\n",t); } /*if(0x43==t) { P0=0xf7; } */ } void main() { mInitSTDIO(); write(); read(); while(1); }
返回結(jié)果是:
Read Data is 3000 Read Data is 3100 Read Data is 3200 Read Data is 3300 Read Data is 3400 Read Data is 3500 Read Data is 3600 Read Data is 3700 Read Data is 3800 Read Data is 3900 Read Data is 4000 Read Data is 4100 Read Data is 4200 Read Data is 4300
結(jié)果貌似沒有問題, 是否需要DISK_BASE_BUF_ADDR、DISK_BASE_BUF_LEN、FILE_DATA_BUF_ADDR 的宏定義改了, 好像和這個沒什么關(guān)系吧