non volatile memory

I am wondering how to save a variable's value in case of power reset.
I am creating a program to write to a display and I want to keep track
of the selection that the user made before the system power went
down and got reset. How can I do this?

Thanks for any help, Vida

Parents
  • Hi Vida,
    you should refer the manual about usage of #pragma INIT/NOINIT.

    Variables placed in a NOINIT section are not to be initialized with zero by the start-up program. So you have the chance to analyse the content after Reset.

    Example

    #pragma NOINIT
    unsigned int wStateMachine; //not to be initialized
    
    #pragma INIT
    unsigned int wCount;        //zero after reset!


    ...Leo

Reply
  • Hi Vida,
    you should refer the manual about usage of #pragma INIT/NOINIT.

    Variables placed in a NOINIT section are not to be initialized with zero by the start-up program. So you have the chance to analyse the content after Reset.

    Example

    #pragma NOINIT
    unsigned int wStateMachine; //not to be initialized
    
    #pragma INIT
    unsigned int wCount;        //zero after reset!


    ...Leo

Children
More questions in this forum