本帖最后由 liw_ei 于 2010-5-28 11:11 编辑
在an2594范例中每次是电都要用 u16 EE_Init(void) 设置状态
从这9种状态看每次必定有1个区要被擦除。
在多次上电下,不知同一区多次擦除会不会,减少寿命
Page1
Page0
ERASED RECEIVE_DATA VALID_PAGE
ERASED
Invalid state
Erase both pages
and format page0
Erase Page1 and mark
Page0 as VALID_PAGE
Use page0 as the valid page
and erase page1
RECEIVE_DATA
Erase Page0 and
mark Page1 as
VALID_PAGE
Invalid state
Erase both pages and
format page0
Use page0 as the valid page
& transfer the last updated
variables from page0 to
page1 & mark page1 as valid
& erase page0
VALID_PAGE
Use page1 as the
valid page and
erase page0
Use page1 as the valid page
& transfer the last updated
variables from page1 to
page0 & mark page0 as
valid & erase page1
Invalid state
Erase both pages and format
page0 |