msp430f4152中有256字节的信息存储器,地址从0x1000到0x10ff,分为四段A、B、C、D,0x1000~0x103F;0x1040~0x107F;0x1080~0x10BF;0x10C0~0x10FF。
void write_SegC(char value)
{
char *Flash_ptr; // Flash pointer
unsigned int i;
FCTL2 = FWKEY + FSSEL0 + FN1;
Flash_ptr = (char *)0x1080; // Initialize Flash pointer
FCTL3 = FWKEY; // Clear Lock bit
FCTL1 = FWKEY + ERASE; // Set Erase bit
*Flash_ptr = 0; // Dummy write to erase Flash seg
FCTL1 = FWKEY + WRT; // Set WRT bit for write operation
for (i = 0; i < 16; i++)
{
*Flash_ptr++ =0x88; // Write value to flash
}
FCTL1 = FWKEY; // Clear WRT bit
FCTL3 = FWKEY + LOCK; // Set LOCK bit
}
程序如上,前三个信息段改变一下指针的地址,数据都能写进去,但是第四个段0x10C0~0x10FF,数据一直写不进去,一直显示0XFF,求高手帮忙解决一下