Michael Gois wrote : > 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. Ji. I think you have banking troubles, see comments in the code... Regards Jan-Erik. > EEPROM_WRITE_TEST > bsf STATUS,RP1 ; Bank 2 > bcf STATUS,RP0 ; - We are in bank 2 now !! > movlw 0x00 ; Address to write to > movwf EEADR ; Move into EEPROM address reg > movlw 0xAA ; Some test data > movwf EEDATA ; Save data to write - Still in bank 2 !! > call EEPROM_WRITE ; Write to EEPROM > bcf STATUS,RP1 - Maybe this "bcf" should be before the "call" ? - > return > > > EEPROM_WRITE > bcf PIR2,EEIF ; Clear any previous EEPROM interrupt - PRI2 is in bank 0 *but* we are still in bank 2 !! - You are actualy clearing a bit in EEADR, I think... The rest doesn't matter much... :-) :-) -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads