專注差異化嵌入式產(chǎn)品解決方案 給智能產(chǎn)品定制注入靈魂給予生命
提供開發(fā)工具、應(yīng)用測試 完善的開發(fā)代碼案例庫分享
從全面的產(chǎn)品導(dǎo)入到強大技術(shù)支援服務(wù) 全程貼心伴隨服務(wù),創(chuàng)造無限潛能!
提供新的芯片及解決方案,提升客戶產(chǎn)品競爭力
提供最新的單片機資訊,行業(yè)消息以及公司新聞動態(tài)
十年單片機開發(fā)方案公司深圳英銳恩分享讀寫PIC16F877單片機內(nèi)部EEPROM的實例。
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