Declaring a nonvolatile variable in flash memory using _at_ keyword


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
  • counts the number of interrupts that is generated via a push button

    I hope you have debounced your push button ...

    I need to know the  C command to solve this problem

    There is no specific 'C' function.

    You have to understand how to do non-volatile storage in your chip, and then implement that in 'C'.

    You will need to study the chip's documentation and/or contact the manufacturer for details of what facilities it provides for non-volatile storage, and how to use them.

    It has nothing specifically to do with Keil.

    If xdata is used instead of idata then the variable will be stored in the ram

    Not necessarily: as far as the CPU is concerned, it is just an address space - the chip manufacturer might have mapped non-volatile storage into that space.

    Again, you will need to study the chip's documentation and/or contact the manufacturer for details.

No data
More questions in this forum