STC8A8K64D4 Series Manual
-
NOP
LOOP:
CPL P1.1
JMP LOOP
END
6.7.13 Wake up MCU from Power Saving Mode using comparator interrupt
( Recommended for use with power-down wake-up timer)
In the power saving mode when the clock is stopped, it is not recommended to start the LVD and comparator, or hardware
system will automatically start internal high precision 1.19 V reference source which has a corresponding temperature drift
and calibration circuit, and leads to about 300uA extra power consumption. After MCU enters into the clock stopped vibration
mode, the working voltage of 3.3V only takes about 0.4uA current, so it is not recommended to open the LVD and comparator
when the MCU enters the clock stop mode. If it is really needed, it is recommended to turn on the power-down wake-up timer.
The power-down wake-up timer will only increase the power consumption of about 1.4uA, which is acceptable for general
systems. The MCU is awakened every 5 seconds by the power-down wake-up timer. After wake-up LVD, comparator and
ADC can be used to detect the external battery voltage. The detection took about 1ms. Then it enters the clock
shutdown/power-saving mode. In this way, the increased average current was less than 1uA, and the overall power
consumption was about 2.8uA (0.4uA + 1.4uA +1uA).
C language code
// Operating frequency for test is 11.0592MHz
#include "reg51.h"
#include "intrins.h"
sfr CMPCR1 = 0xe6;
sfr CMPCR2 = 0xe7;
sbit P10 = P1^0;
sbit P11 = P1^1;
sfr P0M1 = 0x93;
sfr P0M0 = 0x94;
sfr P1M1 = 0x91;
sfr P1M0 = 0x92;
sfr P2M1 = 0x95;
sfr P2M0 = 0x96;
sfr P3M1 = 0xb1;
sfr P3M0 = 0xb2;
sfr P4M1 = 0xb3;
sfr P4M0 = 0xb4;
sfr P5M1 = 0xc9;
sfr P5M0 = 0xca;
void CMP_Isr() interrupt 21
{
CMPCR1 &= ~0x40; //Clear interrupt flag
P10 = !P10; //Test port
}
void main()
{
P0M0 = 0x00;
P0M1 = 0x00;