Hello Folks, I am having some difficulty with writing to the data eeprom in a 16F877. I coded in some data at org 2100 and can read the data with no problem. When I try to write to one of the address, it destroys the existing data. I am using code from the Microchip data for 16F87X as follows: write_eeprom ; writes data into PIC EEPROM bsf STATUS, RP1 bsf STATUS, RP0 ; bank 3 btfsc EECON1, WR goto $-1 bcf status, RP0 ; get and write the memory address ;call ser_in ; get address movlw 0x03 ; hard code addr for debug movwf EEADR ; address to register ; get and write the data ;call ser_in ; get data movlw 0x41 ; hard code data for debug movwf EEDATA ; data into memory bsf STATUS, RP0 bcf EECON1, EEPGD ; point to Data memory bsf EECON1, WREN ; enable write bcf INTCON, GIE ; disables INT's movlw 0x55 movwf EECON2 ; 55h must be written to EECON2 movlw 0xAA ; to start write sequence movwf EECON2 ; write AAh bsf EECON1, WR ; set WR bit, begin write bsf INTCON, GIE ; restore ints. bcf EECON1, WREN ; disable writes return I have hard coded the address and data for debug purposes. Running the simulator does not show any change in the EEPROM WINDOW when this runs. Hope someone can shed some light on this as I have spent many days experimenting to no avail. Regards, Sandy Phelps __________________________________________________ Do You Yahoo!? Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger. http://im.yahoo.com -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads