Hello! Is there a C language program code example for the low-power mode of MC9S08DZ60 chip? I want it to enter low-power mode! For example, waiting mode and stop mode! I also hope to be able to perform key wake-up and interrupt wake-up on it! thank you!
Hi @wangbengang,
We do not have a C code example and guidelines to create complete C application, as the needs of every customer are very particular and custom. However please find below my recommendations for achieving this.
I recommend you disable the watchdog, this in order to avoid any reset for not feeding it when the MCU is in stop mode, you can do this by clearing COPT bits in SOPT1.
Also, is important to enable the stop instruction, if this is not done it will generate an illegal opcode reset when trying to enter this mode.
To do this you need to enable STOPE bit in SOPT1 register
During stop mode all system clocks, including the crystal oscillator (when used), are halted in order to minimize power consumption, in such system an external interrupt is needed, however there are a few clocks that could be configure in order to also generate an interrupt and wake up the MCU.
For external pin interrupt I recommend you check the Interrupt Pin Request Status and Control Register (IRQSC) and the register of the port you want to use, only Port A, port B, and port D pins can be configured as external interrupt
Hope it helps you!