eeprom数据存储器写校验
写校验根据应用的需要,编程时一般要求对已写入EEPROM的数据与所需值相校验(例7-3)。应用中,
当EEPROM 的数据位擦写次数接近其极限值时,就应进行写校验。Total EnduranceTM 磁盘将
有助于您确定放心程度。
写校验
BCF STATUS, RP0 ; Bank0
: ; Any code can go here
: ;
MOVF EEDATA, W ; Must be in Bank0
BSF STATUS, RP0 ; Bank1
READ
BSF EECON1, RD ; YES, Read the value written
BCF STATUS, RP0 ; Bank0
;
; Is the value written (in W reg) and read (in EEDATA) the same?
;
SUBWF EEDATA, W ;
BTFSS STATUS, Z ; Is difference 0?
GOTO WRITE_ERR ; NO, Write error
: ; YES, Good write
: ; Continue program
页:
[1]