At 03:52 PM 05/02/2002 +1300, you wrote: >Now that my stocks of F84 are dwindling, I'm moving s/w over >to the F628. I hope I'm not missing anything embarrassingly >obvious, but this EEPROM routine (which did work on the F84, >before the necessary changes to PIR1) doesn't seem to work. >It's straight from the manual > >What happens is that the LED turns on at the start of the routine >but never goes out, indicating that the write didn't finish or the >routine didn't complete > >If the circuit is reset, the value intended to be written is at the >EEPROM location it should be > >What has me head-scratching is the address of 1C compiled >for EECON1 with WREN EECON1 is in bank 1 (9Ch) >WTF ? I've looked at Microchip's latest data, but that repeats >what is in the manual The datasheet is just plain wrong from memory! Taken from a recent 'F628 project: ee_write: ; btfsc ee_busy ;is the eeprom busy from a previous write? goto ee_write ;yes, loop & wait bcf gie ;no, disable the global interupt bank1 ;bank 1 movwf eeadr ;set up eeprom address movf ee_temp,w ;get data for eeprom saved in calling routine movwf eedata ;set eeprom data bsf wren ;enable eeprom writing movlw h'55' ; movwf eecon2 ;eeprom write unlock sequence movlw h'aa' ; movwf eecon2 ;eeprom write unlock sequence bsf wr ;initiate data eeprom write bank0 ;bank 0 bsf ee_busy ;set flag to say eeprom is busy bsf gie ;re-enable the global interupt return ;exit Regards... -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body