Hi everyone
I’m having problems writing to EEPROM on the PIC16F684. I searched the board for similar problems (here and on MICROCHIP forum ) and it helped me solve some of the errors. However, I want to write a literal to address 1 and see the result in the EEPROM watch window in MPLAB SIM . My code below does not give any errors during BUILD. But when I run the simulation, the program is stuck at BTFSS. And I don’t see any changes in the EEPROM window . Thanks for your help
I’m having problems writing to EEPROM on the PIC16F684. I searched the board for similar problems (here and on MICROCHIP forum ) and it helped me solve some of the errors. However, I want to write a literal to address 1 and see the result in the EEPROM watch window in MPLAB SIM . My code below does not give any errors during BUILD. But when I run the simulation, the program is stuck at BTFSS. And I don’t see any changes in the EEPROM window . Thanks for your help
Code:
#include <P16F684.inc>
__CONFIG _CP_OFF & _CPD_OFF & _BOD_OFF & _PWRTE_ON & _WDT_OFF & _INTRC_OSC_NOCLKOUT & _MCLRE_ON & _FCMEN_OFF & _IESO_OFF
w_temp equ 0x7E
status_temp equ 0x7F
org 0x000
goto main
org 0x004
movwf w_temp
movf STATUS,w
movwf status_temp
movf status_temp,w
movwf STATUS
swapf w_temp,f
swapf w_temp,w
retfie
main
loop1
BCF INTCON,GIE ;DISABLE INTERUPTS
BSF STATUS, RP0 ;Bank 1
MOVLW B'00000001' ;USE ADRESS 1 IN EEPROM MEMORY
MOVWF EEADR
MOVLW B'00001111' ; SEND THIS VALUE AS THE DATA TO ABOVE ADRESS
MOVWF EEDATA
BSF EECON1, WREN ;Enable write
MOVLW 55h ;
MOVWF EECON2 ;Write 55h
MOVLW 0AAh ;
MOVWF EECON2
BSF EECON1,WR
writing ; delay until write is complete
btfss PIR1,EEIF
goto writing
BSF INTCON, GIE ;Enable INTs.
goto loop1
end