Is there a simple way to store a boolean value that persists when power has been turned off?
-
1If there is some power somewhere, you can preserve data by keeping it in a chip that still has power. If all power is totally off, then you would need non-volatile memory such as an EEPROM or serial flash. I suppose you could figure out some way to store the bit in a capacitor, and read it when the power is restored. But capacitors don't stay charged forever, so eventually the bit would revert to 0 (uncharged). – user57037 Oct 26 '15 at 04:06
-
1A lot of microcontrollers have integrated EEPROM. That could store several bits. – HighInBC Oct 26 '15 at 04:08
-
7A small [latching or impulse-type relay](http://www.microchip.com/forums/m424874.aspx) could work, but it must be set to the desired state before power is removed. (If miniature size is desired, try the [FTR-B3](http://www.fujitsu.com/downloads/MICRO/fcai/relays/ftr-b3.pdf) series from Fujitsu.) – rdtsc Oct 26 '15 at 04:31
-
1A model servo turns a rotary switch, that you can read ;-) – Neil_UK Oct 26 '15 at 07:18
-
1single bit magnetic core memory? https://sites.google.com/site/wayneholder/one-bit-ferrite-core-memory – Icy Oct 26 '15 at 09:27
-
Old solution: battery-backed SRAM. Current solution: EEPROM or Flash. New solution: FRAM in microcontroller or serial IC. – pjc50 Oct 26 '15 at 11:16
-
it's not the same question. here a PROM would be allowed, in the other answer it's mentioned but not the right answer, because PROM is not allowed – Sascha May 20 '19 at 22:39
2 Answers
The most simplest way to store a bit I can think of is a literal, mechanical switch. Switch closed - Current can flow: 1, Switch open - No current: 0. Yes this requires human input to flip the bit if necessary but it isn't going to change if the power is turned off or on (unless you change it yourself) - acting like a mechanical register. Mechanical solutions are easy to understand, and implement, but the drawback is for the amount of information one switch can hold (one bit), a regular EEPROM chip could hold hundreds to thousands of MBs. Hope this helps!

- 600
- 6
- 17
Depends from the MCU. MCU with integrated RTC have Vbat pins for lithium battery that is backing power for clock, some MCU models have also a small SRAM for data retention, backed with same battery. If the data has to be stored persistently, then you could use part of flash EEPROM. In this case you would require a signal from PSU that is went off, a large capacitor that will sustain enough power to flash your data and then to put a MCU into sleep mode.

- 23,562
- 2
- 20
- 33