Power fail vs Reset indication
Hal Albach
Posts: 747
in Propeller 1
Could someone tell me if there is a location within the P1 that differentiates between a power fail startup and a reset driven startup. What I would like to find is an internal memory location or register that I can test to see which event caused a restart. Or possibly a location that can be modified during program execution and have that modification not be altered by pressing the reset button but does change when power is interrupted.
Comments
http://www.digikey.com/product-detail/en/torex-semiconductor-ltd/XC6119N27A7R-G/893-1239-1-ND/5879157
When the supply voltage goes below threshold, the output goes low and stays low after powering up again for a period depending upon the timing cap. You need a timing cap large enough to accommodate the Prop's rather lengthy reset time. Then, when your program starts, just read the pin its output is connected to. If it's low, a power-fail reset occurred; if high, a push-button reset.
There are other supervisor chips out there. Microchip makes a lot of them in three-pin TO92 packaging. But the hold times after power-up could range as low as 150 ms, even with a "350 ms" rated chip. That's why I focussed on the above chip with cap-programmable hold time.
-Phil
The idea can become a rudimentary UI by measuring by how long the button is kept pressed. Another pin with an led can provide user feedback; let them know when to let go in order to select the desired option. I often use that as a KISS interface for modes of operation, standby, run, calibration, etc...
Brilliant! I really love this idea and have a need for exactly what it does for a project in the works. Thanks for posting Tracy!!!
Your method is quite ingenious! How do you connect DTR to your circuit, and how does it respond to a DTR reset?
Thanks,
-Phil
Hal, William, I do hope that helps. I think I first used the technique on the Stache Stamp programmer, built around an SX20 chip. A button and an LED let the user select which of 14 possible programs to load into the target Stamp.