代码如下,执行完后SAF还是原来KIT3写入的那些数据,请大佬指点下哪里出错了,谢谢!
烧录完执行,然后再用KIT3读的。
<div>;配置字部分代码</div><div>#include "P16F15313.INC" ; processor specific variable definitions
list p=16f15313, r=DEC
__CONFIG _CONFIG1, _FEXTOSC_OFF & _RSTOSC_HFINT1 & _CLKOUTEN_OFF & _CSWEN_OFF & _FCMEN_OFF
__CONFIG _CONFIG2, _MCLRE_OFF & _PWRTE_OFF & _LPBOREN_OFF & _BOREN_OFF & _BORV_LO & _ZCD_OFF & _PPS1WAY_ON & _STVREN_OFF
__CONFIG _CONFIG3, _WDTCPS_WDTCPS_31 & _WDTE_OFF & _WDTCWS_WDTCWS_7 & _WDTCCS_HFINTOSC
__CONFIG _CONFIG4, _BBSIZE_BB512 & _BBEN_OFF & _SAFEN_ON & _WRTAPP_OFF & _WRTB_OFF & _WRTC_OFF & _WRTSAF_OFF & _LVP_OFF
__CONFIG _CONFIG5, _CP_OFF</div><div>
</div><div>;SAF擦除代码</div><div>BANKSEL NVMDATL
</div> MOVLW 07H
MOVWF NVMADRH
MOVF 80H
MOVWF NVMADRL
BCF NVMCON1,NVMREGS
BSF NVMCON1,FREE
BSF NVMCON1,WREN
BCF NVMCON1,LWLO
BCF INTCON,GIE
MOVLW 55h
MOVWF NVMCON2
MOVLW 0AAh
MOVWF NVMCON2
BSF NVMCON1,WR
BSF INTCON,GIE
BCF NVMCON1,WREN
|