Below is the code of me for writing the number into the PIC. And I am using the datasheet code but is not writing into it. Can anyone tell me why?
After the program write, I press EEDATA then View EEPROM but the value not change at all. Can someone tell me why?
Thank you very much for the help
BANKSEL EEADR ; select Bank EEPROM ADDRESS REGISTER
MOVLW b'00110000' ; write b'00110000' into work register
MOVWF EEADR ; Data Memory Address to write
MOVLW b'00110000' ; write b'00110000' into work register
MOVWF EEDAT ; Data Memory Value to write
BANKSEL EECON1 ; select Bank EEPROM CONTROL REGISTER
BCF EECON1, EEPGD ; Point to DATA memory
BSF EECON1, WREN ; Enable writes
BCF INTCON, GIE ; Disable INTs.
BTFSC INTCON, GIE ; test if the global interrupt is clear, SEE AN576
GOTO $-2 ; go back two lines
MOVLW 0x01 ; write b'00000001' into work register
MOVWF EECON2 ; Write 1 into first byte
MOVLW 0x02 ; write b'00000010' into work register
MOVWF EECON2 ; Write 2 into second byte
BSF EECON1, WR ; Set WR bit to begin write
BSF INTCON, GIE ; Enable INTs.
BCF EECON1, WREN ; Disable writes
BCF STATUS, RP0 ; select Bank 2
BCF STATUS, RP1 ; select Bank 0
After the program write, I press EEDATA then View EEPROM but the value not change at all. Can someone tell me why?
Thank you very much for the help
BANKSEL EEADR ; select Bank EEPROM ADDRESS REGISTER
MOVLW b'00110000' ; write b'00110000' into work register
MOVWF EEADR ; Data Memory Address to write
MOVLW b'00110000' ; write b'00110000' into work register
MOVWF EEDAT ; Data Memory Value to write
BANKSEL EECON1 ; select Bank EEPROM CONTROL REGISTER
BCF EECON1, EEPGD ; Point to DATA memory
BSF EECON1, WREN ; Enable writes
BCF INTCON, GIE ; Disable INTs.
BTFSC INTCON, GIE ; test if the global interrupt is clear, SEE AN576
GOTO $-2 ; go back two lines
MOVLW 0x01 ; write b'00000001' into work register
MOVWF EECON2 ; Write 1 into first byte
MOVLW 0x02 ; write b'00000010' into work register
MOVWF EECON2 ; Write 2 into second byte
BSF EECON1, WR ; Set WR bit to begin write
BSF INTCON, GIE ; Enable INTs.
BCF EECON1, WREN ; Disable writes
BCF STATUS, RP0 ; select Bank 2
BCF STATUS, RP1 ; select Bank 0