本帖最后由 yzcook 于 2019-4-9 10:49 编辑
请问这个是sram芯片吗想用51对他进行存取数据
是否想24c02那样 需要模拟iic?
#i nclude<reg52.h> #i nclude <ABSACC.h>//包含片外存储空间绝对地址访问函数:XBYTE[] sbit oe=P2^7;//片外RAM芯片片选和地址锁存器74HC573使能 unsigned char code ramdata[100]= //定义100个数据 { 0,1,2,3,4,5,6,7,8,9, 10,11,12,13,14,15,16,17,18,19, 20,21,22,23,24,25,26,27,28,29, 30,31,32,33,34,35,36,37,38,39, 40,41,42,43,44,45,46,47,48,49, 50,51,52,53,54,55,56,57,58,59, 60,61,62,63,64,65,66,67,68,69, 70,71,72,73,74,75,76,77,78,79, 80,81,82,83,84,85,86,87,88,89, 90,91,92,93,94,95,96,97,98,99 }; //延时ms函数: void Delayms(unsigned int t) { unsigned int i,j; for(i=t;i>0;i--) for(j=120;j>0;j--); } //主函数: int main(void) { unsigned char i; oe=0;//使能RAM芯片片选和地址锁存器 for(i=0;i<100;i++) XBYTE[300+i]=ramdata; //将100个数据写入片外RAM,起始地址为:300 while(1) { for(i=0;i<100;i++) { SendByte(XBYTE[300+i]); Delayms(500); } } return 0; }
|