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.
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.
shivam177770@gmail.com said:counts the number of interrupts that is generated via a push button
I hope you have debounced your push button ...
shivam177770@gmail.com 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.
shivam177770@gmail.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.
shivam177770@gmail.com said: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?
shivam177770@gmail.com said: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.
shivam177770@gmail.com said: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.