資源簡介
STM32F4實現(xiàn)掉電一瞬間數(shù)據(jù)存儲,STM32F4實現(xiàn)掉電一瞬間數(shù)據(jù)存儲,STM32F4實現(xiàn)掉電一瞬間數(shù)據(jù)存儲,
代碼片段和文件信息
#include?“InternalFlash.h“
#include?“ctl_logic.h“
?
//單片機上電load完參數(shù)后執(zhí)行此函數(shù)擦除掉電的時候進入低電壓中斷重新保存最新的數(shù)據(jù)
int?erase_flash(void){
?//解鎖FLASH
FLASH_Unlock();
FLASH_ClearFlag(FLASH_FLAG_EOP|FLASH_FLAG_OPERR|FLASH_FLAG_WRPERR|?FLASH_FLAG_PGAERR|FLASH_FLAG_PGPERR|FLASH_FLAG_PGSERR);
?/*?開始擦除操作?*/
if(FLASH_EraseSector(FLASH_Sector_11VoltageRange_3)!=FLASH_COMPLETE)
{?
??/*擦除出錯*/
??return?-1;
}?
/*?給FLASH上鎖,防止內(nèi)容被篡改*/
??FLASH_Lock();?
return?0;
}
int?status?=?0?____i=0;
uint32_t?__word_item_no_array_counts?=?0;
uint32_t*?__p_word_item_no_array??=?NULL;
int?fmt_convert_save_parameter(ctl_logic_t*ctl_logicuint8_t*?item_no){
?__word_item_no_array_counts=TBX_CHAR_LEN/4;//64?Bytes?/?4?=?16?
?__p_word_item_no_array?=?(uint32_t*)item_no;
?//解鎖FLASH
FLASH_
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????1763??2017-11-20?16:53??InternalFlash.h
?????文件???????5717??2017-11-22?14:26??InternalFlash.c
-----------?---------??----------?-----??----
?????????????????7480????????????????????2
評論
共有 條評論