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...)
Sadly, STOP mode is not part of the standard 8051 core - so behaviour is going to be chip specific. And nothing to do with Keil.
You might try http://www.8052.com but that, like 8051 use in general, is "dwindling" (to be polite).
Presumably too much to hope that the "sketchball Asian" manufacturer has any kind of support ... ?
If it's a rip-off of a (more) well-known brand, perhaps they might have better documentation/support? Or perhaps you could "model" the behaviour on their part? If it still exists ...
:(