1. Idle mode
Idle mode refers to the state where only the microcontroller is not working. At this time, the CPU has no clock and stops working, but the external interrupt, external low voltage detection circuit, timer, A/D conversion, serial port, etc. are still running normally.
In idle mode, the RAM, stack pointer (SP), program counter (PC), program status word (PSW), accumulator (A) and other registers retain their original data. The I/O ports retain the logical state before the idle mode is activated.
At this time, all peripheral devices of the microcontroller can operate normally. When any interrupt occurs, they can wake up the microcontroller. After the microcontroller is woken up, the CPU will continue to execute the next instruction of the idle mode statement.
How do I exit idle mode?
a. Interrupt: Any interrupt will cause IDL/PCON.0 to be cleared by hardware, thus exiting the idle mode;
b. External RST pin reset: Pull the reset pin high to generate a reset. Then pull the RST pin low to end the reset, and the MCU will start working normally from 0000H of the user program.
What is the purpose of idle mode?
The purpose of putting the microcontroller into idle mode is usually to reduce the power consumption of the system. For example, everyone has used a digital multimeter. When it is in normal use, the microcontroller inside the meter is in normal working mode. When it is not in use, the power of the multimeter is forgotten to be turned off. Most meters will automatically turn off the LCD display after waiting for a few minutes without human operation to reduce system power consumption. Usually, the implementation of such functions uses the idle mode or power-down mode of the microcontroller. Taking the STC89 series microcontroller as an example, the power consumption of the microcontroller is usually 4mA to 7mA when it is working normally. When it enters the idle mode, its power consumption drops to 2mA. When it enters the power-down mode, the power consumption can be reduced to less than 0.1μA.
2. Sleep mode (also called power-down mode, stop mode)
When the MCU enters power-down mode, the external crystal oscillator stops, the CPU, timer, and serial port all stop working, and only the external interrupt continues to work. The instruction that puts the MCU into sleep mode will become the last instruction executed by the MCU before sleep. After entering sleep mode, the data in the data memory and special function registers not involved in the program in the chip will maintain the original value. The MCU can be awakened by an external interrupt low level trigger, a falling edge trigger interrupt, or a hardware reset mode. It should be noted that when the interrupt is used to wake up the MCU, the program continues to run from the original stop point. When the hardware reset is used to wake up the MCU, the program will start from the beginning.
How do I exit sleep mode?
a. The external pins that can wake up the CPU from sleep mode are: external interrupt 0, external interrupt 1, timer 0, timer 1, RxD, PWM0/PCA0/P3.7, PWM2/PCA2/P2.0, PWM3/PCA3/P2.4
b. External reset can also wake up the MCU from power-down mode. After reset, the MCU will start working normally from 0000H of the user program.
The power management register PCON controls the microcontroller to enter idle mode and sleep mode. The lowest two bits of this register, IDL and PD, are used to set whether the microcontroller enters idle mode and power-down mode respectively.
Set IDL/PCON.0 to 1, and the microcontroller enters the IDLE mode.
Set PD/PCON.1 to 1, and the microcontroller will enter the power down mode.
For more detailed information, please refer to Chapter 2 of the STC12 series microcontroller data sheet:
Previous article:Some empirical understanding of microcontroller current
Next article:Multi-core processor architecture and debugging
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- An important representative enterprise in 70 domestic chip sub-sectors!
- MSP-EXP5529 Experimental Board Circuit Diagram
- I would like to ask about the bootstrap principle in the following circuit (please give me more details, please help me)
- [Central Enterprise Recruitment] China Academy of Electronics Science Recruitment of Embedded/Algorithm Engineers
- How to burn Yingguang's microcontroller
- Controlling Hardware with Python - Automating Frequency Response Testing of Conditioning Circuits
- How does a water leak detector work?
- Detailed explanation of AP and STA working modes of wireless Wifi module
- EEWORLD University ---- Common Errors and Solutions in DC/DC Converter Design
- 【I-Prober 520】Unboxing and simple review