You either need to use the interupt to determine when the write is complete, or add a delay to ensure the write completes. Refer to the data sheet where it details exactly how the write sequence occurs. --- On Mon, 11/3/08, Hasan Khan wrote: > From: Hasan Khan > Subject: [PIC] EEPROM won't change > To: "PIC List" > Date: Monday, November 3, 2008, 6:35 AM > Hi, > I have a project where I need to write some constant values > into eeprom of a 16f84a. I am writing the code in mplab and > testing it on its simulator. This code won't work > because simulator shows no change in eeprom values or the > registers EECON1 and EECON2. It does show EEDATA and EEADR > changin. Here is the simplified code. Thanks for any help. > > #include p16f84a.inc > > list p=16f84a > > org 0x00 > > ;initialize EEPROM > banksel EEDATA > movlw 0x34 > movwf EEDATA > movlw 0x01 > movwf EEADR > > bsf STATUS, RP0 ; BANK 1 > bcf INTCON, GIE > > bsf EECON1, WREN ; Enable Write > movlw 0x55 > movwf EECON2 ; Write 55h > movlw 0xAA > movwf EECON2 ; Write AAh > bsf EECON1,WR ; Set WR bit > > bsf INTCON, GIE > bcf STATUS,RP0 ; BANK 0 > > end > > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist