Are there any PIC microcontroller programmers here?
I am learning PIC microcontroller programming using pickit2 and 16F690 chip that comes with it. I am currently working on various objects. I can successfully read the byte from the EEPROM in the code if I set the EEPROM vaklue to MPLAB, but I can't seem to change the value using the PIC itself. Just nothing happens and I do not read the changed value, do I always get the original, which implies that the recording is not working?
This is my code for this section, am I missing something? I know that I have a lot of unnecessary bank switches, I added most of them to make sure that being in the wrong bank is not a problem.
; ------------------------------------------------------
; Now SET the EEPROM location ZERO to 0x08
; ------------------------------------------------------
BANKSEL EEADR
CLRF EEADR ; Set EE Address to zero
BANKSEL EEDAT
MOVLW 0x08 ; Store the value 0x08 in the EEPROM
MOVWF EEDAT
BANKSEL EECON1
BSF EECON1, WREN ; Enable writes to the EEPROM
BANKSEL EECON2
MOVLW 0x55 ; Do the thing we have to do so
MOVWF EECON2 ; that writes can work
MOVLW 0xAA
MOVWF EECON2
BANKSEL EECON1
BSF EECON1, WR ; And finally perform the write
WAIT
BTFSC EECON1, WR ; Wait for write to finish
GOTO WAIT
BANKSEL PORTC ; Just to make sure we are on the right bank