国产精品无码一区二区三区A片_无码狠狠躁久久久久久久91_国产精品久久久久久久_国产99九九久久无码熟妇_国产人妻精品久久久久野外_久久夜色精品国产欧美乱极品_91精品国产色综合久久不卡98口_精品人妻系列无码人妻免费视频

技術(shù)熱線: 4007-888-234
設(shè)計(jì)開(kāi)發(fā)

專注差異化嵌入式產(chǎn)品解決方案 給智能產(chǎn)品定制注入靈魂給予生命

開(kāi)發(fā)工具

提供開(kāi)發(fā)工具、應(yīng)用測(cè)試 完善的開(kāi)發(fā)代碼案例庫(kù)分享

技術(shù)支持

從全面的產(chǎn)品導(dǎo)入到強(qiáng)大技術(shù)支援服務(wù) 全程貼心伴隨服務(wù),創(chuàng)造無(wú)限潛能!

新品推廣

提供新的芯片及解決方案,提升客戶產(chǎn)品競(jìng)爭(zhēng)力

新聞中心

提供最新的單片機(jī)資訊,行業(yè)消息以及公司新聞動(dòng)態(tài)

如何較快的清除內(nèi)置eeprom的內(nèi)容?

更新時(shí)間: 2019-03-26
閱讀量:3313

;========================================================== ;= use buffer : Address => EEPROM action address buffer ;= example: movlw D'10' 位址10讀出 ;= call EE_READ_A ;= : Address = D'10' ;= : TMP1,TMP2 = data ;=========================================================== ; EE_READ_A: MOVWF ADDRESS EE_READ: MOVLW D'02' MOVWF CNT1 BCF STATUS,C RLF ADDRESS,W BANK_1 MOVWF EEADR ;point to EEPROM EE_READ_LOOP: BANK_1 BSF EECON1,RD ;read data from EEP MOVFW EEDATA ; INCF EEADR,F BANK_0 BTFSC CNT1,1 MOVWF TMP2 BTFSS CNT1,1 MOVWF TMP1 DECFSZ CNT1,F GOTO EE_READ_LOOP RETURN

;================================================================ ;= use buffer : Address => EEPROM action address buffer ;= example: movlw H'55' 位址10寫(xiě)入0x55 0x55 ;= movwf TMP1 ;= movwf TMP2 ;= movlw D'10' ;= call EE_WRITE_A ;= Address = D'12' ;================================================================ ; MEMORY_WRITE: MOVWF TMP1 CLRF TMP2 MOVLW PWR_MEM EE_WRITE_A: MOVWF ADDRESS EE_WRITE: MOVLW D'02' MOVWF CNT1 BCF STATUS,C RLF ADDRESS,W BANK_1 MOVWF EEADR ;point to EEPROM BANK_0

EE_WRITE_LOOP: MOVFW TMP2 BTFSS CNT1,1 MOVFW TMP1 BANK_1 MOVWF EEDATA BSF EECON1,WREN ;enable write BCF INTCON,GIE MOVLW H'55' MOVWF EECON2 MOVLW H'0AA' MOVWF EECON2 BSF EECON1,WR ;寫(xiě)入 BANK_0

;------- wait --------------------------

MOVLW D'43' ; +=> wait 100mSec MOVWF DELAY_2 ; / L_WaitLoop: CLRF DELAY_1 ; \ CLRWDT ; | BTFSS PIR1,EEIF ; | GOTO L_WaitLoop_TP ; | BCF PIR1,EEIF ; | BANK_1 ; | BCF EECON1,WREN ; | L_WaitLoop1: INCF EEADR,F ; point to EEPROM BANK_0 ; | DECFSZ CNT1,F GOTO EE_WRITE_LOOP INCF ADDRESS,F RETURN

L_WaitLoop_TP: ; | INCFSZ DELAY_1,F ; | GOTO L_WaitLoop+1 ; | DECFSZ DELAY_2,F ; | GOTO L_WaitLoop ; / GOTO L_WaitLoop1 ;

;下面為清除程序,清除地址為00H----3FH,清除值為0FFH,上面一個(gè)是讀子程序一個(gè)是寫(xiě)子程序,但在清除中只用寫(xiě)

;子程序

EEPROM_ERROR: CLRF ADDRESS ; SET EEPROM ADDRESS 0 ERASE_LOOP: MOVLW H'0FF' ; ERASE EEPROM 00-3FH MOVWF TMP1 ; MOVWF TMP2 ; CALL EE_WRITE ; BTFSS ADDRESS,6 ; GOTO ERASE_LOOP ; GOTO RESET ;