Power consumption is a top priority for battery power supply systems. we know that a single-chip microcomputer has a power management register pcon, which has the lowest two. IDL and PD are used to set whether the single-chip microcomputer enters the idle mode and the power-down mode respectively.
1. idle mode
When the single-chip microcomputer enters idle mode, all other hardware except the CPU is in sleep state is active, data in memory and special function registers not involved in programs in the chip will be kept in the original value during idle mode. However, if the timer is running, the value in the counter register will also increase. In idle mode, the MCU can be awakened by any interruption or hardware reset. Note that when the MCU is awakened by interruption, the program continues to run from the original stop, when you use hardware reset to wake up the microcontroller, the program will be executed from the beginning.
The purpose of enabling a single-chip microcomputer to enter the idle mode is usually to reduce the power consumption of the system. For example, we have used a digital multimeter, during normal use, the single-chip microcomputer inside the table is in normal working mode. when not in use, you forget to turn off the power of the multimeter. Most tables are waiting for several minutes, if no manual operation is performed, it will automatically turn off the LCD display to reduce the power consumption of the system. Generally, the implementation of this function is to use the idle mode or power-down mode of the microcontroller. Taking stc89 series single-chip microcomputer as an example, the power consumption of the single-chip microcomputer is usually 4mA ~ 7mA. When the idle mode is enabled, the power consumption is reduced to 2mA. When the idle mode is enabled, the power consumption can be reduced to less than 0.1 μA.
2. Sleep mode
When the single-chip microcomputer enters the power-down mode, the external crystal oscillator is stopped, the CPU, the timer, and the serial port are all stopped, and only the external interrupt continues to work. The command that enables the microcontroller to enter sleep mode will become the last command executed by the microcontroller before sleep. After Entering sleep mode, data in memory and special function registers not involved in programs in the chip will be kept in the original value. It can be triggered by low-level external interruptions or by the descent edge to trigger the interrupt or the hardware reset mode to change the wake-up microcontroller. It should be noted that when the interrupt wake-up microcontroller is used, the program continues to run from the original stop, when you use hardware reset to wake up the microcontroller, the program will be executed from the beginning.
You can adjust the digital multimeter to the current file, and connect it to the circuit in a string to observe the total current changes of the single-chip microcomputer in the normal working mode, sleep mode, and idle mode, the test result is as follows: normal current> idle current> sleep current.