摘要 |
A battery-operable portable electronic device, having a removable main power source and an auxiliary power source, generates a power failure interrupt signal when it detects a power failure of the removable main power source. Upon detection of the power failure, the electronic device enters a power down mode in which it monitors recovery from the power failure. The electronic device monitors recovery from the power failure by using a battery check routine it pushes on the stack of a microcontroller, and pops off the battery check routine from the stack upon determining a stable recovery, while returning to an exact point in a main program it left when it detected the power failure, the exact point in the main program being represented by a program counter value automatically pushed on the stack upon occurrence of the power failure interrupt signal. |