Based on the following points of C8051F310 microcontroller, the content to be discussed in this article is proposed and has been tested experimentally.
① The C8051F310 microcontroller enters power-down mode, the CPU stops running, all interrupts and timers (except the clock loss detector) are inactive, and the internal oscillator is stopped (the analog peripherals remain in the selected state, and the external oscillator is not affected). The data in the RAM can be kept unchanged when the supply voltage is greater than 1.5 V, and the power consumption is extremely low, with a current of less than 0.1 μA.
② There are two voltage comparators inside the C8051F31x device, and interrupts can be generated on both the rising and falling edges of the comparator output. The response time of the comparator is programmable, and the positive and negative hysteresis voltages of the comparator are also configurable.
③ The output of the comparator can be synchronized with the system clock or asynchronous. Even when the system clock stops, the comparator asynchronous output CP0A signal is still available, which allows the comparator to work and generate output when the device is in shutdown mode. When disabled, the power supply current of the comparator drops to less than 100 nA.
④ After C8051F310 is running, the contents of the internal data memory do not change during reset, and the data stored before reset remains unchanged. The data in the stack does not change.
Figure 1 MCU power supply and voltage detection principle
In the design of C8051F310 system, a battery is used as a backup power source (the battery voltage is greater than the RAM data retention voltage of C8051F310, 1.5 V). The principle of microcontroller power supply and voltage detection is shown in Figure 1. When the main power supply is normal, adjust the potentiometer so that the voltage at the CP0+ terminal is slightly greater than the voltage at the CP0- terminal. The voltage detection part has two functions: one is to provide an analog input signal for the built-in comparator of the microcontroller; the other is that the output of the operational amplifier drives the LED light to indicate that the main power supply is normal. CP0A can also be connected to the port pin through a cross switch to replace the power amplifier driving the power indicator light in Figure 1. The prerequisite is that the comparator is not disabled before entering the power-down mode and the battery voltage is greater than the minimum operating voltage of the microcontroller, which will increase the battery power consumption during power-down.
When the main power supply VCC is normal, the main power supply voltage is higher than the battery voltage, and the system is powered by the main power supply. When the main power supply voltage drops or is lost due to an accident, comparator 0 sends a power-off interrupt request to the microcontroller. The microcontroller responds to the interrupt and uses the remaining power stored in the filter capacitor on the main power supply to enter and execute the interrupt service subroutine in the shortest time. In the interrupt service subroutine, the contents of some special function registers that must be protected are saved to RAM (the stack area can be used), and analog peripherals such as comparators and analog-to-digital conversion are turned off to reduce power consumption. Finally, a power-off protection mark is established and the microcontroller enters the shutdown working state. After the main power is restored, the microcontroller performs a power-on reset and continues to execute the program from the breakpoint at the time of power failure.
The power-off flag must use the addressable bit in RAM (located at 20H~2FH units), because when the microcontroller is reset, the general flag in the special function register is reset. In the shutdown mode, the internal oscillator, CPU and all digital peripherals stop working, but the state of the external oscillator circuit is not affected. Therefore, it is recommended to use the internal oscillator when designing a low-power system; or use an external oscillator and switch to the internal oscillator in the power-off interrupt service program to further reduce battery consumption in power-off mode. According to Figure 1, the built-in comparator 0 is configured as a falling edge interrupt. The positive and negative hysteresis voltages are configured as 0, and the response time is preferably configured as mode 0. The comparator 0 interrupt service subroutine flow is shown in Figure 2.
Figure 2 Comparator 0 interrupt service routine flow
Figure 3 Main program flow
The main program flow is shown in Figure 3.
When using the power-down mode of the C8051F310 microcontroller, the following three points should be noted:
① Disable WDT (power monitor): prevent the microcontroller from being reset when the battery voltage is greater than the RAM data retention voltage but less than Vrst (microcontroller VDD monitor threshold voltage) after entering power-down mode, causing the microcontroller to be unable to continue executing the program from the breakpoint.
② In the case where the battery voltage is greater than Vrst in power-down mode, the clock loss detector should be disabled. In this way, when power is lost, the microcontroller is kept in power-down mode for a long time, extending the battery life. If the clock loss detector must be used on site, the clock can be selected from an off-chip oscillator, so that the clock is not lost even in power-down mode.
③ Disable comparator 0 reset.
Previous article:Design of intelligent node of vehicle CAN bus based on C8051F040
Next article:Temperature display circuit based on DS18B20 and 89C2051
- Popular Resources
- Popular amplifiers
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
- This piece of clothing generates energy through movement. Can it help solve the problem of a cell phone running out of battery?
- Current sampling in FOC
- TI designs next-generation industrial drive and control systems
- About LM5117 overcurrent protection --- from a provincial competition question in 2016
- CCS installation package
- TI C600 Compile Feedback Output Related Options
- ST NUCLEO-L452RE development board evaluation report summary
- USB communication design example based on CH559 MCU Android AOA protocol
- Technical article | How to use J-Link to burn SPI Flash
- Low power consumption comparison between STM8L and MSP430