Farad capacitors can be used to easily implement power-off detection and data storage for microcontrollers. See the circuit diagram below. Here, 6V power supply (such as 7806) is used first. It is obvious why 6V is used instead of 5V. The diodes in the circuit generally play two roles. One is to clamp 0.6V to ensure that most 51 series microcontrollers can work at a nominal operating voltage between 4.5V and 5.5V. The charge loss time of the 1V voltage between 4.5-5.5 in the 0.47F capacitor is the warning turnaround time that we can plan after the microcontroller power-off detection alarm in the future. The second is to use unidirectional conductivity to ensure unidirectional charging to the energy storage capacitor 0.47F/5.5V.
The two 47 ohm resistors have the following functions: First, they limit the current of the microcontroller power supply. Generally, the microcontroller power supply is directly connected to the 7805, which is an unsafe practice. Why? Because the 7805 can provide a power supply current of up to 2A, which is enough to burn the microcontroller chip when abnormal. With the protection of this 47 ohm resistor, the microcontroller and the three-terminal regulator will not be burned even if the chip or polarity is inserted in reverse, but this resistor cannot be too large, and the upper limit should not exceed 220 ohms, otherwise the programming will fail when programming the microcontroller (actually due to insufficient power). Second, it is used together with 47UF and 0.01UF capacitors to strengthen the power supply filtering. Third, for the 0.47F/5.5V energy storage capacitor, the 47 ohm resistor connected in series eliminates the power-on surge of the "huge farad capacitor" to achieve peak current clipping.
Now let's calculate that to fully charge a 0.47F capacitor to 5.5V, even if a 5.5A constant current is used to charge the 0.47F capacitor, it will take 0.47 seconds to charge to 5.5V, so we can know:
1. If there is no 47 ohm resistor to limit the current, the three-terminal regulator will inevitably enter self-protection due to the strong overcurrent at the moment of power-on.
2. The slow power-on time of 0.47 seconds (if there is a 5.5A constant current charge) will make the 51 single-chip microcomputer with a differential (RC circuit) reset circuit unable to achieve power-on reset because the power-on time is too slow. (In fact, it often takes several minutes to fully charge a 0.47UF capacitor).
3. Because the power-on time is too slow, it will not match the waiting response time reserved by most of today's mainstream online writing (ISP) type microcontrollers and the upper computer software of the writing chip (generally no more than 500MS), resulting in a loss of response, so it always prompts "communication failure".
Knowing this principle, it is not difficult for you to understand that the diode and resistor at the top of this circuit are connected in series to form a power-on acceleration circuit. A Schottky diode (1N5819) (hollow inside and without blue) is also used here to discharge from the farad capacitor to the microcontroller VCC, and at the same time block the bypass effect of the farad capacitor on the power-on acceleration circuit. The Schottky diode is used based on its conduction voltage of only about 0.2V under low current. The purpose is to minimize the voltage loss of the farad capacitor when the microcontroller is powered off. Leave more power-off maintenance time.
The transistor 9014 and the clamping diode voltage divider resistor pad resistor (470 ohms) form a base-emitter double-ended input comparator to realize the microcontroller power-off detection and issue the highest priority power-off interrupt. The microcontroller saves the program execution when it powers off. This part of the circuit is equivalent to half of the comparator LM393, but the circuit is simpler and consumes less power (the power consumption is less than 0.15MA when the power is off).
The 47K resistor and the 470 ohm diode 1N4148 form a clamping circuit to ensure that the base potential is about 0.65V (which can be calculated as 0.6 (diode conduction voltage) + 5*0.47/47). In this way, if the emitter voltage of 9014 is 0 (at this time, the external power is off), the transistor 9014 is just turned on, and because the high level of P3.2 of the 51 microcontroller is weakly pulled up (about 50UA), at this time 9014 must be turned on and weakly saturated with current, so that the INX0 power-off detection interrupt with the highest hardware priority is sent to the microcontroller.
During normal power supply, since there is a voltage of about 6*0.22/2.2=0.6V on the emitter, it is not difficult to find that transistor 9014 must be in the cut-off state, and P3.2 maintains a high level, and the microcontroller power-off preservation interrupt program is not triggered.
Finally, there are two important software and hardware notes:
Software: First, INX0 is at the highest priority in hardware (design), and here we must also ensure the highest level of priority in software. This ensures that when the microcontroller loses power, external interrupt 0 can interrupt any other process and be detected and executed with the highest priority. Secondly, when INX0 is powered off, save the entry of the subroutine module and use:
MOV P1, #00H
MOV P2,#00H
MOV P3,#00H
MOV P0,#00H
SJMP Power-off save
To block the charge of the farad capacitor from leaking out through the microcontroller port line and then jump to the power-off save write subroutine module. (See Hardware Points)
Hardware: For any device that drives the external port line of the microcontroller and outputs a high level to drive external devices, its power supply cannot compete with the power supply voltage VCC of the microcontroller (for example, the power supply of the pull-up resistor is not taken from the VCC of the microcontroller). Instead, it should be directly connected in front of the power supply. The 4.7K resistor and the port line PX.Y in the figure is a typical example, and the connection of other port lines PX.Y' and loads is similar. The diode connected in series with the pull-up 4.7K resistor here also has two functions: 1. Clamp off the 0.6V voltage to match the working voltage of the microcontroller, and prevent the port line from pushing back the power to the inside of the microcontroller, causing the function of the microcontroller port line to be disordered. 2. Use the unidirectional power supply characteristics of the diode to prevent the microcontroller from supplying power to the power supply and external devices through the port line after power failure.
The above MCU power-off detection circuit, when combined with the power-off saving writing subroutine module, can ensure that during the power-off of the MCU, the accumulated charge on the farad capacitor will not provide unnecessary power to the external circuit that has been powered off and reverse power to the power supply, causing the capacitor energy to be discharged and shorten the power-off maintenance time.
With these basics, let's calculate the power-off working time of the microcontroller that can be maintained when the 0.47UF capacitor drops from 5.5V to 4.5V (or even to 3.6V). Here, assuming that the microcontroller operating current is 20MA (the peripheral drive current has been shielded), it is not difficult to calculate:
T=1V*0.47*1000 (1000 is because the working current is HaoA)/20=23.5 seconds!
Previous article:PIC series microcontroller reset circuit
Next article:Introduction to important instructions in PIC microcontroller
Recommended ReadingLatest update time:2024-11-16 13:47
- Popular Resources
- Popular amplifiers
- Wireless Sensor Network Technology and Applications (Edited by Mou Si, Yin Hong, and Su Xing)
- Modern Electronic Technology Training Course (Edited by Yao Youfeng)
- Modern arc welding power supply and its control
- Small AC Servo Motor Control Circuit Design (by Masaru Ishijima; translated by Xue Liang and Zhu Jianjun, by Masaru Ishijima, Xue Liang, and Zhu Jianjun)
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
- When using a crystal oscillator, you should pay attention to the relationship between temperature and
- Accelerometer and gyroscope
- Download of Siemens e-book "PCB Manufacturing Process - Optimization through Digital Transformation" has started~
- DP83822I Industrial Ethernet PHY auto-negotiation function and its strap resistor configuration
- 【DIY】Remodeling the mobile phone battery charger
- Modern processors and optimized code performance
- TMS320F28035 ECAN interrupt sending and receiving
- Request X-CUBE-MEMS1 firmware package
- TI CCS compiler download update
- Simple and efficient zero-point acquisition circuit