If I understand correctly, you want to program 5's into the data EEPROM when you first program the device, and thereafter let them be whatever the PIC has set them to. In MPLAB the assembler directive "de" can be used to do this. org H'F00000' ; Assembler Directive to Initialise EEPROM at programming - h'F00000' is data EEPROM ;address for 18f252, may change depending on your device de 05h,05h,05h,05h,05h ; declare EEPROM - sets 1st,2nd,3rd,4th and 5th EEPROM location to 05h This will set them during programming and will then not be set again. See below: http://techweb.ceat.okstate.edu/eet/EET%203264/Notes/3264%20Ch%2018.doc Regards, DAN ----- Original Message ----- From: "Eric Bohlman" To: Sent: Wednesday, March 26, 2003 9:38 AM Subject: Re: [PIC]: part of program only once > 3/25/03 12:57:14 PM, samo benedihih wrote: > > >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? > > Neither. You somehow need to use one of the EEPROM locations to store a "known good" value which > you check for. If you can't find it, you assume that the EEPROM is uninitialized or corrupted and > initialize it. One way to do this is with a checksum or something similar like a CRC. Another way, > which I used in my most recent design, was to range-check each EEPROM location; all the ones I was > using were settable from an LCD menu, so I had to keep range limits in my code in any case. That > wouldn't work, though, for locations where all 256 possible values were allowed; in that case, I'd > go with a checksum. > > -- > http://www.piclist.com#nomail Going offline? Don't AutoReply us! > email listserv@mitvma.mit.edu with SET PICList DIGEST in the body -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body