Marco Fratini

RAM variables re-declared at power ON

Discussion created by Marco Fratini on Feb 1, 2010
Latest reply on Feb 2, 2010 by kef

Hi. I need to keep the value of some RAM variables after a power loss. I obviously have to use a back-up battery. But I have a doubt. Please consider the following example code:

 

int a; <-- global variable

 

main()

{

... 

a = 10;

...

 

Suppose that power goes down and a = 10. What happens after the new power-on with the declaratione int a? Is the variable "a" redeclared? Would its value be lost?

I'm using the MCF52259DEMOKIT; VSTBY pin is connected to 3.3V but after a reset my variable goes to "0" after it is redeclared. 

Outcomes