摸索了快1个月,我还是不懂如何访问片外RAM地址。 上次发贴请教时,记得strongchen 版主说过访问片外RAM与访问片内RAM方式是一样的,于是我先弄懂访问片内RAM地址的办法,编写程序访问片内RAM 0x2000-0x2005地址如下:
unsigned int *ramaddr; unsigned int a,b,c, x,y,z;
void main(void) { /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/
/* Write your code here */ for(;;) { a=10; b=20; c=30; ramaddr=(volatile unsigned int*)(0x3000);
*ramaddr=a; *ramaddr++;
*ramaddr=b; *ramaddr++;
*ramaddr=c;
z=*ramaddr; *ramaddr--; y=*ramaddr; *ramaddr--; x=*ramaddr;
} /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/ for(;;){} /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/ } /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
该程序执行后x=10,y=20,z=30,成功!
接着我修改程序让它访问外部RAM: 把 ramaddr=(volatile unsigned int*)(0x3000) 改成ramaddr=(volatile unsigned int*)(0x108000) 理所当然地想这下可以访问0x10页的0x8000-0x8005了,但是执行结果失败了!
我又试着改成这个样子: PPAGE=0x10; ramaddr=(volatile unsigned int*)(0x8000); 单步执行时候程序跳进Start12.c中死了!
另外我还试过许许多多的其他办法,仍然失败,我实在没主意了,请各位大侠帮帮小弟我! |