libor
Joined: 14 Dec 2004 Posts: 288 Location: Hungary
|
loss of power eeprom write |
Posted: Thu Jan 06, 2005 4:16 am |
|
|
I use the normal smoothing electrolithyc capacitor for a similar problem. My device has a 220VAV power supply: it has a 220V to 9VAC transformer, a greatz, a 4700uF smoothing cap, and a 5V voltage reg.
A voltage divider direct after the transformer on the 9VAC (before the greatz) connected to the on-board comparator of the PIC serves as a zero-cross detector every 1/50 sec (i made a kind of a software counter watchdog that gets reset at every AC zerocrossing in an interrupt (as a by-effect this pulse also synchronizes my software real-time clock))
If a zerocross was missing, my program knows that the mains power has gone and I have only the power in relative large capacitor that has to decay from 9V to 6-7 VAC before the voltage regulator gives up yielding 5V. With all outside large consumers switched of at the beginning of this 'emergency' save, I have ca. 1 sec time of normal operation of PIC left. I use this time to save some operating parameters to eeprom before the power is completely lost.
Your SD card consumes much more power, and you need perhaps more than 1 sec, so if you have to use a much larger cap, it is less expensive to implement at the lower (regulated) voltage at 5V or 3V. |
|