|
对2012的info flash的 seg B段进行存储操作后,不掉电信息正确,但掉电后信息就没有了变成FF!请问怎么解决。
程序代码如下:
CARD_SET[0]=0x00;
CARD_SET[1]=0x17;
CARD_SET[2]=0x34;
CARD_SET[3]=0x12;
// Write Flash -- erase first
ip=(unsigned char *)FLASH_SegB;
FCTL2=FWKEY+FSSEL0+FN1; // MCLK/3 for Flash Timing Generator
FCTL3=FWKEY;
FCTL1=FWKEY+ERASE; // ERASE Flash
// while (FCTL3 & BUSY);
*ip=0;
// write flash
while (FCTL3 & BUSY);
FCTL1=FWKEY+WRT; // write word or bit
for (i=0;i<4;i++)
{
*ip++=CARD_SET[i];
while (FCTL3 & BUSY);
}
FCTL1=FWKEY;
while (FCTL3 & BUSY);
FCTL3=FWKEY+LOCK;
while (FCTL3 & BUSY);
|
|