Declaring a nonvolatile variable in flash memory using _at_ keyword

Hello,

I am using nuvoton N79E715AT28 mcu for some project in which I need to store some integer values in some non volatile memory space. So that it does not get deleted even after power goes off.

The above mcu provides a user configurable flash memory shared with programe memory(APROM). After configuration the APROM memory address are (0x0000 - 0x3EFF) and the flash memory address are (0x3F00 - 0x3FFF).

I have used the command (unsigned int idata value1 _at_ 0x3F00;), but it gives the error c274: 'value1' : absolute specifier illegal.

Parents Reply
  • f xdata is used instead of idata then the variable will be stored in the ram, which is again a volatile memory.

    And you seriously believed that same argument not to to apply even more strongly to idata?

    What should be the memory type used to store the value in the flash memory having the address (0x3f00 - 0x3fff).

    If it's not xdata, then this almost certainly cannot be modelled as a variable.  You're looking for a memory space that supports writing to, which clearly rules out code, and it's supposed to be at an address with at least 14 bits ... that rules out data, idata and sfr.

    The variable is actually a counter,

    That's precisely the kind of use that you do not want to directly couple updates of the RAM vlue and updates of the data flash storage for.  Odds are your data flash cell(s) will wear out faster than thte button you're counting, that way.

Children
No data
More questions in this forum