|
|
| Author |
Message |
Don_Kirby
Joined: 15 Oct 2006
Posts: 329
Location: Long Island, New York
|
|
Posted: 29 April 2007, 11:50 AM Post subject: Persistent memory default values |
|
|
I'm assuming that the answer is 'undefined', but is there a default value for persistent memory variables on a factory fresh processor? Are all of the positions zeros? Or ones?
The reason I ask is as follows.
On the first run after a program download, I initialize all of my persistent variables (890 bytes of them). I would only like to do this one the first download though, and not on subsequent downloads, so using FirstTime() is out. I can roll my own FirstTime() manually, but want to be sure that the value I choose won't show up accidentally in memory. Granted, if I use anything other than a boolean (a Long set to a specific number for example) the chances are rare that it would just happen to be there already, but I'd like to make sure.
-Don |
|
| Back to top |
|
 |
dkinzer Site Admin
Joined: 03 Sep 2005
Posts: 2593
Location: Portland, OR
|
|
Posted: 29 April 2007, 15:12 PM Post subject: Re: Persistent memory default values |
|
|
| Don_Kirby wrote: | | [I]s there a default value for persistent memory variables on a factory fresh processor? Are all of the positions zeros? Or ones? |
I find nothing in the mega32/644 datasheets that specifies the initial value. My observation, however, has been that the bits are all ones.
| Don_Kirby wrote: | | I can roll my own FirstTime() manually, but want to be sure that the value I choose won't show up accidentally in memory. |
It may be helpful to use a multi-byte indicator value such as &H55aa based on the theory that, whatever the default initial value, all bits will have the same value. |
|
| Back to top |
|
 |
|