我Flash/EE 存储器进行读写,之前出现过能观看寄存器正确操作写入0X55AA 然后同样的地址读出来为0XFFFF
(错误值)。经过测试一段时间后重新建立工程,就出现了正确读到0X55AA的情况 。然后昨天又出现了读出的是OXFFFF
的情况,对于手头项目比较紧张,希望ADI公司能尽快帮我解决问题。附带FLASH 操作基本程序
unsigned short
Flash_Red(unsigned short FlashAddr)
{
unsigned short
FlashData;
unsigned char Status;
FEEMOD=FEEMOD|0x8; //Erase key
enable
FEEADR=FlashAddr;
FEECON=READ_HALF_WORD;
Status =
FEESTA&0x03;
while (!(Status)) Status = FEESTA&0x03;
if
((Status&0x02)==0x02) ERROR = 1;
FlashData=FEEDAT;
FEEMOD&=0xfff7;
//Erase key unable
return FlashData;
}
void ErasePage(unsigned
short FlashAddr )
{
unsigned char Status;
FEEMOD=FEEMOD|0x8; //Erase
key enable
FEEADR=FlashAddr;
FEECON=ERASE_PAGE;
Status =
FEESTA&0x03;
while (!(Status)) Status = FEESTA&0x03;
if
((Status&0x02)==0x02) ERROR = 1;
FEEMOD&=0xfff7; //Erase key
unable
}
void Flash_Write (unsigned short FlashAddr,unsigned short
FlashData)
{ unsigned char Status;
FEEMOD=FEEMOD|0x8; //Erase/Red key
enable
FEEADR=FlashAddr;
FEEDAT=FlashData;
FEECON=WRITE_HALF_WORD;
Status =
FEESTA&0x03;
while (!(Status)) Status = FEESTA&0x03;
if
((Status&0x02)==0x02) ERROR = 1;
FEEMOD&=0xfff7; //Erase key
unable
}