hi, i once used the code below and it was working. but i had troubles when writing or reading several addresses at a time. when adding a delay of 40ms between two accesses to the eeprom, it worked. tino char EEADR_@0x09b; char EEDATA_@0x09a; char EECON1_@0x09c; char EECON2_@0x09d; void EepWrite(char addr, char data) { // write data to eeprom EEADR_ = addr; EEDATA_ = data; set_bit(EECON1_,2); clear_bit(INTCON,7); EECON2_=0x55; EECON2_=0xaa; set_bit(EECON1_,1); set_bit(EECON1_,0); //verify set_bit(INTCON,7); clear_bit(PIR1,1); } char EepRead(char addr) { //read data from eeprom char tmp; EEADR_ = addr; set_bit(EECON1_,0); tmp = EEDATA_; return tmp; } Royce Simmons Gesendet von: pic microcontroller discussion list 22.11.02 16:08 Bitte antworten an pic microcontroller discussion list An: PICLIST@MITVMA.MIT.EDU Kopie: Thema: [PIC]: Writing EEPROM Hello All, Does anyone have a code fragment showing how to write a byte to the EEPROM in a P16F628? I looked at page 93 in the 16F62X manual but I did not see where to set the EEADR register and move the data to the EEDATA register. Also is the "reqiured sequence" needed for each write? Regards, Royce -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu