- STOP mode and keyboard scan. When the calculator is ON, the STM32 spends most of its life in STOP mode for minimal power consumption. It can wake up on either external interrupt from the keyboard, or, once a second, on the timer interrupt to toggle the EXTCOMIN signal for Sharp LCD. When the key is pressed, STM wakes up, performs a needed operation, and waits for the key to be released. The waiting cycles are, however, done without sending the MCU to STOP. So, while the button is being pressed, the MCU runs on its full 8 MHz and draws around 4 mA from battery. This needs to be fixed eventually.
- Switching the calculator ON. When the calculator is OFF, all the columns of the keyboard matrix have external interrupts enabled. So, whenever the button is pressed while in OFF, the MCU wakes up, scans the keyboard, and if the button that is pressed is not ON, goes back to STOP. In principle, a better way would be to only enable the interrupt from the column connected to the ON button. However, the straightforward implementation of this appeared to be buggy (it worked, but for some reason the average current draw in OFF was much higher). I've postponed this for now.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.