首页 | 新闻 | 新品 | 文库 | 方案 | 视频 | 下载 | 商城 | 开发板 | 数据中心 | 座谈新版 | 培训 | 工具 | 博客 | 论坛 | 百科 | GEC | 活动 | 主题月 | 电子展
返回列表 回复 发帖

由外扩外部RAM引发的问题

由外扩外部RAM引发的问题

请问版主,我在做外部RAM的扩展时,看了freescale给的技术文档,发现有个现象,有的使用ECLK给锁存器时钟,有的是将ECS和XCS经过与非门后再接到锁存器上作为输入时钟,不知道该用那一种?请版主仔细说明一下。我也看了论坛上过去关于RAM的例子,可是还是不太明白呀!
  另外请版主讲一下ECS和XCS到底是做什么的。
版主能不能给一个读取外部RAM的C语言例子呀,感觉无从下手
我要变得更强
ECS和XCS只是用作扩展模式下的片选信号,并不是时钟信号。它们可以用来选通择外部地址译码电路。

这里有一个简单的读取外部RAM的例子:
#include /* common defines and macros */
#include /* derivative information */

#pragma DATA_SEG __PPAGE_SEG EX_RAM
word ex_testram[5];

#pragma DATA_SEG DEFAULT

word tempp=0;

void delaymin()
{
word i,j,t;
for(j=0; j<6; j++)
for(i=0; i<20000; i++)
{
t++;
}
}

byte tt0;
word tt1;
byte i;

void main(void) {
while(1) {
tempp++;
for(i=0; i<5; i++) {
tt0 = tempp + i;
tt1 = tt0;
ex_testram = tt1;
tempp++;
tt1 = ex_testram;
}
delaymin();
}
}

PRM文件为:


NAMES
END

SEGMENTS
RAM = READ_WRITE 0x0400 TO 0x1FFF;
/* unbanked FLASH ROM */
ROM_4000 = READ_ONLY 0x4000 TO 0x7FFF;
ROM_C000 = READ_ONLY 0xC000 TO 0xFEFF;
/* banked FLASH ROM */
PAGE_30 = READ_WRITE 0x308000 TO 0x30BFFF;
PAGE_38 = READ_ONLY 0x388000 TO 0x38BFFF;
PAGE_39 = READ_ONLY 0x398000 TO 0x39BFFF;
PAGE_3A = READ_ONLY 0x3A8000 TO 0x3ABFFF;
PAGE_3B = READ_ONLY 0x3B8000 TO 0x3BBFFF;
PAGE_3C = READ_ONLY 0x3C8000 TO 0x3CBFFF;
PAGE_3D = READ_WRITE 0x3D8000 TO 0x3DBFFF;
/* PAGE_3E = READ_ONLY 0x3E8000 TO 0x3EBFFF; not used: equivalent to ROM_4000 */
/* PAGE_3F = READ_ONLY 0x3F8000 TO 0x3FBFFF; not used: equivalent to ROM_C000 */
END

PLACEMENT
_PRESTART, /* Used in HIWARE format: jump to _Startup at the code start */
STARTUP, /* startup data structures */
ROM_VAR, /* constant variables */
STRINGS, /* string literals */
VIRTUAL_TABLE_SEGMENT, /* C++ virtual table segment */
NON_BANKED, /* runtime routines which must not be banked */
COPY /* copy down information: how to initialize variables */
/* in case you want to use ROM_4000 here as well, make sure
that all files (incl. library files) are compiled with the
option: -OnB=b */
INTO ROM_C000/*, ROM_4000*/;
DEFAULT_ROM INTO PAGE_38,PAGE_39,PAGE_3A,PAGE_3B,PAGE_3C;
EX_RAM INTO PAGE_30;
DEFAULT_RAM INTO RAM;
END

STACKSIZE 0x100

VECTOR 0 _Startup /* reset vector: this is the default entry point for a C/C++ application. */
//VECTOR 0 Entry /* reset vector: this is the default entry point for a Assembly application. */
//INIT Entry /* for assembly applications: that this is as well the initialisation entry point */
海纳百川  有容乃大
PAGE_30 = READ_WRITE 0x308000 TO 0x30BFFF;
PAGE_38 = READ_ONLY 0x388000 TO 0x38BFFF;
PAGE_39 = READ_ONLY 0x398000 TO 0x39BFFF;
PAGE_3A = READ_ONLY 0x3A8000 TO 0x3ABFFF;
PAGE_3B = READ_ONLY 0x3B8000 TO 0x3BBFFF;
PAGE_3C = READ_ONLY 0x3C8000 TO 0x3CBFFF;
PAGE_3D = READ_WRITE 0x3D8000 TO 0x3DBFFF
定义这个起什么作用啊?
这是定义每个页的物理地址范围,是用引导wizard创建project时自动生成的PRM文件本身就有的。
海纳百川  有容乃大
返回列表