What I have done is this. When the EEPROM is virgin, meaning its totally erased, the values should be 0xFF (but on a new part I've actually seen 0x00) so test some location for either value, then init the EEPROM and write over that same 'test' location with something else. Next time you go into the program, first thing is test for the 'new' value. If its present, ignore the writing else init the locations. >From: samo benedihih >Reply-To: pic microcontroller discussion list >To: PICLIST@MITVMA.MIT.EDU >Subject: [PIC]: part of program only once >Date: Tue, 25 Mar 2003 19:57:14 +0100 > >Hi all! > >I'm building central heating controller. In INIT phase of my program there >is a few instructions that preload first five EEPROM locations with number >five. What I'd like to know is: how do I tell the PIC that it should >execute >this part of program only at first go after programming the PIC and that it >shouldn't touch EEPROM in INIT phase after any kind of reset. Is it POR or >BOR bit that I should test? >I'm using 16f877. > >Thanks in advance, Samo > >-- >http://www.piclist.com hint: The PICList is archived three different >ways. See http://www.piclist.com/#archives for details. _________________________________________________________________ Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu