SparkFun Forums 

Where electronics enthusiasts find answers.

Your source for all things Atmel.
By sdisselhorst
#102244
I am having some trouble with PROGMEM. All I want is to store a few unsigned integers into nonvolatile memory. Wht would be an example of the code for this? I have tried the following:

I am getting a value "calval" by using a potentiometer and the map command.
I want to store the value so my program can use it later.
I want this value to survive powering down.
I have tried storing the value using this:
prog_uint16_t ppgmainmem[] PROGMEM = (calval);
is this right to store it?
and then to retrieve it I have tried:
ppgmain = pgm_read_byte(ppgmainmem);
but it doesn't give me the right value, I think.
The stored value, should be , for example 29, but when I print it out it is only a 2.
Any helpers?