Continue to Site

Welcome to

Welcome to our site! is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

write data in ram onto eeprom when there is a power outage

Not open for further replies.


Junior Member level 2
Jan 2, 2006
Reaction score
Trophy points
Activity points
how write data to ram

hello everybody, my name is narender, a final year degree.

iam doing my project on pre piad energy meter. i am facing a trouble with the design. brief about my project. there will be an energy meter ic which wil be converting the instantaneeous load into pulses and a microcontroller which will be counting those pulses and when ever the count becomes 1500 pulses then some counter is incremented and is written into the serisl eeprom chip. now when ever the counter is just to less than 1500 pulses and there is a power outage, then all the ram contents are lost. i,e a total of 1 kwh is lost. so for this i have to design a power back up unit(from batery) which will detect a power outage and swith on very quickly whenever there is power outage and i will write a interrup service routine to write the contents of the counter into the serial eeprom and after that my back up(from battery) unit also should shut down. and on power resumption i should take the values from the serial eeprom and then start counting from there.

how can this be done, a non volatile ram is not an economical one so i cant go for it. can anyone help me with some other low cost circuit and get my purpose solved.

sorry for my english.

thanks in advance.

save data in eeprom before power shutdown

Simplest battery backup: use two diodes;
(Main power supply) -|>- (µC) -<|- (battery)

(µC) is your controller and EEPROM
-|>- and -<|- are diodes

Main power supply voltage should be little above battery voltage and diodes should be low drop out type.

You could also add charging for battery (if carefully designed battery side diode could be removed; battery is charged when main PS is online)

how write kwh in eeprom

thank you sir, but my problem is not with the recharging circuit its with detecting the power outage at very faster rate. im my project iam using a clock frequency of 11.095 mhz clock. for this clock how fast i should detect the outage and how to detect so fast and switch on the battery supply and go to the interrrupt service routine and save my data into the eeprom and then switch on the battery also.


power fail write data eeprom

Early warning for shutdown routine
Critical systems often require an early warning when the power-supply voltage (VCC) begins to fall. The warning allows time for the µP to store vital data and perform "housekeeping" chores before the declining VCC causes the supervisor to issue a hard reset. If the raw dc input voltage is accessible, it can be monitored with an undervoltage or power-fail comparator, which in turn asserts a processor interrupt to indicate when the unregulated supply is collapsing.

Quoted from:
**broken link removed**
If you think an IC is worth trying in your design ask MAXIM for free samples ..


Re: write data in ram onto eeprom when there is a power outa

You only need to have power during the time it takes the uContr. to write into the eeprom and to shutdown. At worst case this would be a couple of seconds. This power can be taken from the power supply capacitors. Probably there is no need for a battery backup, just bigger capacitors.
To detect the outage you must sense the AC voltage. instead of the DC voltage that feeds the uC. In this way you can detect the AC outage very early when there is enough energy left on the power supply to save the data.
Hope this helps

Re: write data in ram onto eeprom when there is a power outa

Hello OlVi

Is there something about designing these crcuits on the net?
I am eager to read something more about it


Re: write data in ram onto eeprom when there is a power outa

Albert22 is right.
Depending on what you've to save in EEPROM residual energy is sufficient.
I've already done it using an H8S from Renesas and it works.
I'm using a FRAM to store more than 100 32 bit parameters in it at powerdown.
In the worst case you could use a supercap.


Not open for further replies.

Part and Inventory Search

Welcome to