on a 12f629 how can i write a value to the eprom(1,1) when i program it, so that it has an intial value of 1 and then the pic will make changes to it as it runs, i only need that value put in once ever, so I can't have it in the code for the pic?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Something like this?
The EEPROM addresses can all wipe to FF on first programming, so you can sense this and use it to do a single write. Successive power-ups won't change the existing value (providing that you don't change it back to FF).
--- startup code ----
.
.
x=EPread (1)
if x=0xFF then EPwrite (position,somevalue)
.
.
--- end of startup code ---
Main
.
.
EPwrite (position,newvalue)
rest of program
.
.
goto Main
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
on a 12f629 how can i write a value to the eprom(1,1) when i program it, so that it has an intial value of 1 and then the pic will make changes to it as it runs, i only need that value put in once ever, so I can't have it in the code for the pic?
Something like this?
The EEPROM addresses can all wipe to FF on first programming, so you can sense this and use it to do a single write. Successive power-ups won't change the existing value (providing that you don't change it back to FF).
--- startup code ----
.
.
x=EPread (1)
if x=0xFF then EPwrite (position,somevalue)
.
.
--- end of startup code ---
Main
.
.
EPwrite (position,newvalue)
rest of program
.
.
goto Main