PIC读写EEPROM实例及说明
;*************************************************************************
***************
; This is a program to test the function of reading&writting for EEPROM.
; You can observe the value of register(30H--
?) buy changing "VALU" and "WRC_".
; Notice that:it must be { ADDR+WRC_
; Written by Yamato.:)
;***************************************************************************
*************
include "p16f877.inc"
ADDR EQU 20H ;写入地址寄存器
VALU EQU 21H ;写入值
REC_ EQU 22H ;读计数
WRC_ EQU 24H ;写计数
org 0
goto main
main
bcf STATUS,RP1
bcf STATUS,RP0 ;bank0
movlw 10h
movwf ADDR ;写入EEPROM初始值
movlw 90h
movwf VALU ;初始写入值
movlw 30h
movwf FSR ;间址,读出值初始存放地址
movlw 0Fh
movwf WRC_ ;写入次数
movwf REC_
;incf REC_ ;读出次数
wri_ ;写子程序
bsf STATUS,RP1
bsf S……