Good points.
So maybe the solution for Gator is to write a program to run that will write a known value to the EEPROM then re-program the PIC with the working code.
Might not be so good for production though.
Good points.
So maybe the solution for Gator is to write a program to run that will write a known value to the EEPROM then re-program the PIC with the working code.
Might not be so good for production though.
Dave
Always wear safety glasses while programming.
Gator just wants the values not to be overwritten @ further power ups ...
so, it only needs to write a SURE default value @ first programming ( DATA ...)
I do agree the DATA line must be commented or modified ,if some minor ( ? ) prog mods are done AND he doesn't want to loose previous values.
But this never happens in real life ... does it ???
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Idea...
Not sure exactly how to do it...
Use WRITECODE to over write the DATA line.
Where is the DATA line???
Dave
Always wear safety glasses while programming.
Thanks for the ideas. I found an easy way now:
This isnt the code but gives the idea.
READ 0, blah
startup:
if blah = "1" then goto 1
if blah = "2" then goto 2
WRITE 0, "1" 'if it wasnt 1 or 2 then it reaches here
goto startup
1:
2:
This way if it doesnt have a needed value, it writes it then restarts. The second time it runs it will have one of the right values.
Quick EEPROM question while I'm at it. How reliable is the EEPROM memory? I want that value to stay there once the user selects it no matter how many shutdowns/powerups there are.
A typical way that I use in my codings
At power on
if EEPROM_Magic <> $1234 then
' store initial defaults to EEPROM (as many as you need)
EEPROM_Magic = $1234 ' indicate I have valid readings here
' and save all these values to the eeprom
endif
' Now load the EEPROM values and continue with program
EEPROM_Magic is a word sized variable that is saved in EEPROM and contains a magic number that you choose(1234 Hex here)
Regards
I usually add this near the top of my code before any variable declarations
Just be mindful of how much EEPROM your chip has, and you might want to write 255 instead of 0. You might only use 10 locations and that would look likeCode:data @0, 0(256) 'set all EEPROM data to 0 on initial programming
Then early in the loop read and check for the default valueCode:data @0, 255(10) 'set 10 EEPROM data to 255 on initial programming
David
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Bookmarks