專注差異化嵌入式產(chǎn)品解決方案 給智能產(chǎn)品定制注入靈魂給予生命
提供開(kāi)發(fā)工具、應(yīng)用測(cè)試 完善的開(kāi)發(fā)代碼案例庫(kù)分享
從全面的產(chǎn)品導(dǎo)入到強(qiáng)大技術(shù)支援服務(wù) 全程貼心伴隨服務(wù),創(chuàng)造無(wú)限潛能!
提供新的芯片及解決方案,提升客戶產(chǎn)品競(jìng)爭(zhēng)力
提供最新的單片機(jī)資訊,行業(yè)消息以及公司新聞動(dòng)態(tài)
十年單片機(jī)開(kāi)發(fā)方案公司深圳英銳恩分享讀寫(xiě)PIC16F877單片機(jī)內(nèi)部EEPROM的實(shí)例。
LIST P=16f877
#INCLUDE
;
;- RAM LOCATIONS------
;
; Reserve RAM location 0x70 for ICD
;
Data_EE_Addr equ 0X71
Data_EE_Data equ 0X72
;--------VECTORS------------
org 0x0
nop
goto START
;-------PROGRAM--------------
org 0X20
START
call INIT
;
;---- Test the WRITE EEPROM Routine ----
;
movlw 0x0
movwf Data_EE_Addr
movlw '0' ; Load a ASCII code "0" to W
movwf Data_EE_Data
EE_Write
call WRITE_EEPROM
incf Data_EE_Data,F ; 0x30+ N
incf Data_EE_Addr,F ; Point to next EEPROM Address
btfss Data_EE_Addr,5 ; Write 32 bytes ?
goto EE_Write
;
;---- Test the READ EEPROM Routine ----
;
movlw 0x20 ; Get back EEPROM data to RAM with start addr at 0x20
movwf FSR
;
movlw 0x0 ; Point to EEPROM start address at 0x00
movwf Data_EE_Addr
EE_Read
call READ_EEPROM ; Read EEPROM data with curent address to W registre
movwf INDF ; move W --> RAM
;
incf FSR,F
incf Data_EE_Addr,F ; Point to next EEPROM Address
btfss Data_EE_Addr,6 ; Read 32 bytes ?
goto EE_Read
;
GOTO