I do have an ISR in my real code. I posted a simplified version of the code. I also do have an end less loop at the end. Removing GIE and adding endless loop doesn't solve my problem. ----- Original Message ---- From: Tamas Rudnai To: Microcontroller discussion list - Public. Sent: Monday, November 3, 2008 9:55:32 PM Subject: Re: [PIC] EEPROM won't change Why are you tickling the GIE if you do not have ISR, anyway? Also you do not have a never ending loop at the end of your code so the execution will continue through the uninitialised program memory until the PC overflows and your firmware starts up againg... and again... and again... Tamas On Mon, Nov 3, 2008 at 3:07 PM, alan smith wrote: > 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 > -- Rudonix DoubleSaver http://www.rudonix.com -- 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