John Brown wrote: > > I am having trouble writing to the EEPROM in a on 16F873. > > > Any suggestions greatly appreciated! > > bsf STATUS, RP0 ; select register bank 3 > bcf EECON1, EEPGD ; Point to data memory > bsf EECON1, WREN ; Enable writes > ; bcf INTCON, GIE ; Only disable interrupts if already enabled_ > ; ; otherwise discard > movlw 0x55 ; Write 55h to_ > movwf EECON2 ; EECON2 > movlw 0xAA ; Write AAh to_ > movwf EECON2 ; EECON2 > bsf EECON1, WR ; Start write operation > ; bsf INTCON, GIE ; Only disable interrupts if already enabled_ > ; ; otherwise discard > bcf EECON1, WREN ; Disable writes > > goto LOOP RAM bank select is still pointing to RAM page 3 before "goto LOOP" You are writing to the EEPROM about 100 times per second which is probably unnessary. Thats about 2 1/2 hours available time before the location could end its life. ROMzap initialises the PORT & TRIS registers from the boot code, so it's not needed in your user code unless you need to specifically change them. -- Best regards Tony mICros http://www.bubblesoftonline.com mailto:sales@bubblesoftonline.com -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu