This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
void Flash_Write(void) { int16 *data_ptr; uint16 *Flash_ptr; uint8 i; __disable_interrupt(); Flash_ptr = (uint16 *)Flash_default; data_ptr = &product_info.vref_ad_zero; if(FCTL3 & LOCK) FCTL3 = FWKEY | LOCK; //信息段解锁 FCTL3 = FWKEY; // Clear Lock bit FCTL1 = FWKEY + ERASE; // Set Erase bit *Flash_ptr = 0; // Dummy write to erase Flash segment FCTL3 = FWKEY; FCTL1 = FWKEY + WRT; for (i = 0; i < CHECK_P_NUM; i++) { while((FCTL3 & BUSY) == BUSY); //Wait Busy *Flash_ptr++ = *data_ptr++; // Write value to flash } FCTL1 = FWKEY; // Clear WRT bit FCTL3 = FWKEY | LOCK; // Set LOCKSEG bit __enable_interrupt(); }
问题已解决,之前用的是2041这一款芯片,flash较大,使用0xFC00没有影响,现在换为2040,flash较小,而在flash最后一段会有一段芯片内部的数据,现在使用0xFC00会将这一段数据擦除