cancel
Showing results for 
Search instead for 
Did you mean: 

recover a value after a power down ?

fredodq
Associate II
Posted on May 29, 2005 at 19:30

recover a value after a power down ?

3 REPLIES 3
fredodq
Associate II
Posted on May 17, 2011 at 12:07

hi,

I'm an electronic student and i have a question for my training course :

i'd like to recover a value ( signature or assignement ?) after a warm reset caused by a 8051's card (ednmag July 6,2000)

The idea :

In my program, i put in an idata unsigned char a value, i passed in power-down mode and did a warm reset, at the wake up i wanna use this value to orient my prog to the menu or to an other sub (take measures). But after the warm reset the value is empty.

Thank you

type DK3200 uPSD3234A

jdaniel
Associate II
Posted on May 17, 2011 at 12:07

fredodq,

You have a few situations you need to consider to get this done right. First, I assume that you're writing this program in C, and that the idata value you speak of is global or static, correct? If so, you should know that the C specification dictates that all of these values will be initialized to zero on program startup. If you're using something like Keil as a compiler, it's going to zero them all out for you when it uses C_INITSEG. This is all pretty hidden from you, so it's understandable that you wouldn't immediately know why the value disappeared.

To get this to work correctly, you need to remove this item from the list of things that are initialized at startup. This isn't as simple as it sounds, but it certainly can be done.

Another situation you need to take into account is what happens when it's NOT a warm reset, but just a power-up. How will your program know the difference between a random value in RAM and the value that you wanted to use? You need to write some sort of ''key'' sequence in memory along with the value so that you know that memory doesn't just contain random gibberish.

fredodq
Associate II
Posted on May 17, 2011 at 12:07

Thank you phaze426,

I will explore this way