sst29sf040不是flash吗,难道数据会丢失吗?我仿真时看到数据也写进了sst29sf040阿,为什么一烧写进芯片后掉电数据就会恢复为初始化的值呢? 下面是我改变数组 syn 的值并存储到sst29sf040的程序 void ByteProgram(uchar data SrcByte,uint Dst) { XBYTE[0x0555] = 0xAA; XBYTE[0x02AA] = 0x55; XBYTE[0x0555] = 0xA0; XBYTE[Dst] = SrcByte; wait(1,9);//等待25us }
int Erase_One_Sector(uint Dst) {
/* Issue the Sector Erase command to 39SF040 */
XBYTE[0x0555] = 0xAA; /* set up address to be 555h */ /* write data 0xAA to the address */ XBYTE[0x02AA] = 0x55; /* set up address to be 2AAh */ /* write data 0x55 to the address */ XBYTE[0x0555] = 0x80; /* set up address to be 555h */ /* write data 0x80 to the address */ XBYTE[0x0555] = 0xAA; /* set up address to be 555h */ /* write data 0xAA to the address */ XBYTE[0x02AA] = 0x55; /* set up address to be 2AAh */ /* write data 0x55 to the address */ XBYTE[Dst] = 0x20; /* set up starting address to be erased */ /* write data 0x30 to the address */ wait(85,134); /* check DATABOOK for the most */ /* accurate value -- Tse */ }
uchar ByteRead(uint addr) { uchar GetData; GetData = XBYTE[addr]; return(GetData); } void sst_save()//用于保存易丢失数据 { uchar i; Erase_One_Sector(128); for(i=0;i<4;i++) { ByteProgram(syn[2*i+1],0x0080+i); syn[2*i+1]=ByteRead(0x0080+i); } } void main() { sst_save(); } |