>WRITEEE: > bsf STATUS,RP0 ; set up EEADR and EEDATA first > bcf INTCON, GIE ; disable interrupts temporarily > clrf EECON1 Not quite sure why you clear this register. But ok. > bsf EECON1,WREN ; enable write > movlw H'55' ; magic sequence > movwf EECON2 > movlw H'AA' > movwf EECON2 > bsf EECON1,WR > bsf INTCON, GIE ; reenable interrupts > bcf EECON1, WREN ; disable EEPROM write > >EELOOP: > btfsc EECON1,EEIF ; wait for WR to go low ^^^^^ Apparently you didn't read my message carefully enough. It should be btfss not btfsc. Your write cycle was probably not complete by the time you ended the write sequence and returned. > goto EELOOP ; not yet > bsf EECON1,WREN > bcf EECON1,EEIF ; clear the interrupt flag > bcf STATUS,RP0 ; return to page 0 > return > > >READEE: > movwf EEADDR ; set up eeprom address from W > bsf STATUS,RP0 ; change to page 1 > bsf EECON1,RD ; set the read bit > bcf STATUS,RP0 ; back to page 0 > movf EEDATA,W ; return value in W > return Everything else looks ok. --Andrew _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu