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.
There is definitely no address 0x3f00 in idata. That'll have to be xdata. It may not even make sense to model this requirement as a variable, because that would mean the code would just write to it any time you change that variable. Write access to data flash generally has to be controlled more strictly to avoid wear.
If xdata is used instead of idata then the variable will be stored in the ram, which is again a volatile memory.
What should be the memory type used to store the value in the flash memory having the address (0x3f00 - 0x3fff).
The variable is actually a counter, which counts the number of interrupts that is generated via a push button, this counter value must be stored in some non volatile memory so that after the restart of the mcu the counter must start from the previous counted value.
I need to know the C command to solve this problem.
email@example.com said:counts the number of interrupts that is generated via a push button
I hope you have debounced your push button ...
firstname.lastname@example.org said: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.
email@example.com said: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.
View all questions in Keil forum