Here's a question for those who understand AVR chips inside and out. I've read that these chips have "brownout detection," though I've never found a good reference for how this is supposed to work. I'm wondering if brownout detection is entirely a hardware thing or if it is a state that can be read and acted upon by software (possibly requiring an end-run around the normal Arduino environment). Here's why I'm interested:
My current Arduino project has a "shutdown routine" wherein it writes certain data to EEPROM just before it goes dead (this is mostly to keep the EEPROM from being written to too often and exceeding its 100,000 write cycle limit, although it could have other useful features as well, depending on the answer to this question.)
If brownout detection can be read by software, it would be possible for the Arduino to execute its brief shutdown routine whenever power failed, since there is always enough power left in its discharging capacitors for it to run for a few seconds following a power failure. This brief source of power quickly falls to a level triggering brownout detection and then, if I can read this from software, I run my shutdown routine. Please tell me if this makes no sense at all. Thanks!