I inherited a physical product that needs to function like this using an 8051 in STOP mode. My user manual is a little light on STOP mode implementation for 8051s.
I can't get this to work, does someone who has used 8051s can weigh in on this?
Desired Actions
Note: Button A is an external interrupt.
1)Hold down Button A, for five seconds. Poll Button A every 5ms. After five seconds of polling, call the STOP(); macro. System shuts down.
2)While system is in STOP mode, press Button A and and system turns back on.
---
The problem I have is that when I hold down Button A for 5 seconds, it triggers the STOP mode. But instantly the system bounces out of STOP mode because Button A is still held down.
The datasheet (sketchball Asian 8051 MCU...) is not clear on the wake-up behavior. In one place it says any input from any from anything on port 1 or port 0 will wake up the MCU from STOP mode. That's not true.
It also suggests that the external interrupts can wake up the MCU. That seems to be true, and explains why STOP mode isn't "sticking" when I use Button A. If I switch the polling to Button B, a non-external interrupt button, the polling method works and the system goes to STOP mode.
Is there some way I could use Button A to trigger the STOP mode, but not have it immediately trigger an external interrupt and pull the system out of STOP mode?
(This was not a system issue with a PIC in an earlier design since it was polling buttons using some kind of deep-sleep watchdog type timer...)
UPDATE
Even though the datasheet does not state it, it looks like the watchdog timer and internal low power clock keep running in STOP mode. There may be a way to jigger some variables to keep the system in STOP even when it is being retriggered.
Am I on the right path?