| Details | Message |
|---|
Read-Only Author Vida Vela Posted 5-Sep-2001 23:30 GMT Toolset C166 |  non volatile memory Vida Vela I am wondering how to save a variable's value in case of power reset. I am creating a program to write to a display and I want to keep track of the selection that the user made before the system power went down and got reset. How can I do this?
Thanks for any help, Vida |
|
Read-Only Author Leonhard Fuchs Posted 6-Sep-2001 07:14 GMT Toolset C166 |  RE: non volatile memory Leonhard Fuchs Hi Vida, you should refer the manual about usage of #pragma INIT/NOINIT.
Variables placed in a NOINIT section are not to be initialized with zero by the start-up program. So you have the chance to analyse the content after Reset.
Example
#pragma NOINIT
unsigned int wStateMachine; //not to be initialized
#pragma INIT
unsigned int wCount; //zero after reset!
...Leo |
|
Read-Only Author Andrew Neil Posted 6-Sep-2001 11:17 GMT Toolset C166 |  RE: non volatile memory Andrew Neil But if power has been lost, RAM contents will also have been lost!
As the title suggests, you need some sort of non-volatile memory; eg, * EEPROM; * Battery-Backed RAM; * If your system has FLASH, it might be possible to use an area of the FLASH for non-volatile data storage
If you use EEPROM, you'd need some way to detect that the power was about to go down, and then quickly save the required values;
With Battery-Backed RAM you'd just need to ensure that the variables were located in the non-volatile area (and use NOINIT) Depending on how long you need to retain the data, you might be able to use a capacitor instead of a battery (there are capacitors available specifically for this purpose)
Triscend has an App Note on using FLASH for data with their E5 devices: http://www.triscend.com/products/an01.pdf
|
|
Read-Only Author erik malund Posted 6-Sep-2001 12:35 GMT Toolset C166 |  RE: non volatile memory erik malund Saving values for power cycle safekeeping is quite an art if you have to be absolutotally sure that the value is relevant. In both flash, EEPROM and battery backed RAM there are conditions where the value can be garbled during power down. A reasonably safe approach is to write the value in 3 places and on power up use 2 that match.
Have fun,
Erik |
|
Read-Only Author tom mazowiesky Posted 6-Sep-2001 13:29 GMT Toolset None |  RE: non volatile memory tom mazowiesky The other thing to do is just store the value in EEPROM or Battery backed ram when it is changed. This saves the complications of implementing a power fail interrupt. On power up, just read the value(s) from the non-volatile device. If the device is an EEPROM or FLASH, just make sure there is enough capacity in the power supply to keep the VCC on long enough to complete the write operation. |
|
Read-Only Author Sven Petersen Posted 6-Sep-2001 16:02 GMT Toolset None |  RE: non volatile memory Sven Petersen A disadvantage of EEPROM and FLASH are the limited number of write cycles. I have recently read about something called FRAM, which is available from http://www.ramtron.com
They say, it will survive like 10^6 writecycles per second for 300 years. It also seems to be available in different sizes and should be fast enough to work with an ordinary 80c51.
I have no experience in using it, though, but it was something that I have kept in my folder of interesting things.
-cu Sven |
|
Read-Only Author Walter Conley Posted 6-Sep-2001 21:31 GMT Toolset None |  RE: non volatile memory Walter Conley FYI:
We have been using FRAM for about 3 years and it works great. They have an 8k byte serial device that is SSC (SPI) compatible. You don't have to worry about erasing or programming them. Just write your data using their protocol designed to eliminate inadvertant write cycles.
I also recently heard that Motorola is working on something using the same or similar technology in a parallel version with much larger densities that can be used to store program and data. They are debating if they should implement the technology in their micros only or if they should offer it in a stand-alone package also.
-Walt
|
|