Hi I have followed the instructions for writing to the internal EEPROM throroughly - I tried copying the code from the PIC datasheet, have tried code I found on piclist, but I cannot get a successful result. My code I use to read and write is at the end of the message. EEPROM_WRITE_TEST sets up the address and data and then calls EEPROM_WRITE to write to EEPROM. EEPROM_READ_TEST sets up address and then calls EEPROM_READ. I am using a PIC16F877 and the IceBreaker is my incircuit debugger. The debugger allows me to read and write straight to EEPROM and I have tried setting values in EEPROM addresses but EEPROM_READ always returns 0xFF (although when I read them with the debugger it returns the correct value, so im sure there is nothing wrong with the EEPROM). Can anyone please help me here and tell me what Im doing wrong - is there something else I need to do other than run this code to access the EEPROM? Thanks in advance.. - Michael EEPROM_WRITE_TEST bsf STATUS,RP1 ; Bank 2 bcf STATUS,RP0 ; movlw 0x00 ; Address to write to movwf EEADR ; Move into EEPROM address reg movlw 0xAA ; Some test data movwf EEDATA ; Save data to write call EEPROM_WRITE ; Write to EEPROM bcf STATUS,RP1 return EEPROM_WRITE bcf PIR2,EEIF ; Clear any previous EEPROM interrupt bsf STATUS,RP0 ; Bank 3 bcf INTCON,GIE ; Disable interrupts bcf EECON1, EEPGD ; Select data EEPROM bsf EECON1, WREN ; Enable writes movlw 0x55 ; 0x55 and 0xAA movwf EECON2 ; are codes which turn movlw 0xAA ; on the EEPROM access movwf EECON2 ; bsf EECON1,WR ; Begin write bsf INTCON,GIE ; Turn on global interrupt mask bcf EECON1,WREN ; Disable writes again bcf STATUS,RP0 ; bcf STATUS,RP1 ; Back to bank 0 btfss PIR2,EEIF ; Wait for write complete goto $ - 1 ; interrupt before continuing bcf PIR2,EEIF ; Clear interrupt bsf STATUS,RP1 ; Bank 2 again return EEPROM_READ_TEST movlw 0x00 ; Address to read from call EEPROM_READ return EEPROM_READ bsf STATUS,RP1 ; bcf STATUS,RP0 ; Bank 2 movwf EEADR ; Set up address bsf STATUS,RP0 ; Bank 3 bcf EECON1,EEPGD ; Select data EEPROM access bsf EECON1,RD ; Enable EEPROM read bcf STATUS,RP0 ; Back to bank 2 movf EEDATA,w ; Get data return -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads