You should clear the EEPGD bit before setting the RD bit in your READEE function. Why not use the routines in the data sheet? They seem to work ok. Mike > -----Original Message----- > From: Hardware Engineering [SMTP:pic-ineer@USA.NET] > Sent: Tuesday, January 16, 2001 3:07 PM > To: PICLIST@MITVMA.MIT.EDU > Subject: [PIC]: 16F6871 EEPROM write hangs no longer but not working? > > OK...good news is that it does not hang...yet does not appear to be > working > still...hard to tell if its the read or write of course > > > > WRITEEE: > bsf STATUS,RP0 ; set up EEADR and EEDATA first > bcf INTCON, GIE ; disable interrupts temporarily > clrf EECON1 > 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 > 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 > > ____________________________________________________________________ > Get free email and a permanent address at http://www.netaddress.com/?N=1 > > -- > http://www.piclist.com hint: To leave the PICList > mailto:piclist-unsubscribe-request@mitvma.mit.edu > > -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu