I'm working on a project in which i need to be able to store a value to the PIC's EEPROM, I have managed to get the read to work but so far i am unable to get the PIC to write to the memory using PIC assembly. This is the code that i have been using , it is derived from the example write code from the data sheet, I am using the 16D630 PIC, and using the PIC assembly language.
MOVLW 0x02
MOVWF EEADR
MOVLW 0x01
MOVWF EEDATA
BSF STATUS,RP0 ;BANK 1
BSF EECON1,WREN ;ENABLE WRITE
BCF INTCON,GIE ;DISABLE INTS
MOVLW 0x55 ;UNLOCK WRITE
MOVWF EECON2 ;
MOVLW 0xAA ;
MOVWF EECON2 ;
BSF EECON1,WR ;START THE WRITE
BSF INTCON,GIE ;ENABLE INTS