Power failure detection circuit and data storage method based on power failure detection circuit
By designing a circuit including main power supply module, power supply energy storage module, core functional module, non-core functional module and power-down detection module, the problem of difficulty in efficient detection of power supply voltage in power isolation scenarios in the prior art is solved, and efficient data storage processing in different scenarios is realized, reducing design complexity and cost.
Patent Information
- Application Number
- CN202510316597.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-18
- Publication Date
- 2025-06-06
AI Technical Summary
The existing power-down detection circuit is difficult to efficiently realize power-down detection of power-down detection of power-up voltage in power-isolated scenarios, and the design is complex and costly, so it cannot adapt to the needs of different scenarios.
A circuit including main power supply module, power supply energy storage module, core functional module, non-core functional module and power outage detection module is designed. The output voltage of the main power supply module is detected and controlled through the power outage detection module to ensure efficient control of power supply components and power receiving components in power isolation and non-isolation scenarios.
It realizes efficient and adaptive detection of power supply voltage and data storage processing in different scenarios, avoiding data loss or storage errors, and reducing the complexity and cost of circuit design.
Smart Images

Figure CN120103956A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of power failure detection, and in particular to a power failure detection circuit and a data storage method based on the power failure detection circuit. Background Art
[0002] In the technical field of power failure detection, a power failure detection circuit is used to detect the power failure status of a power supply voltage to ensure that data is stored in a timely manner.
[0003] However, in related power-off detection circuits, an operational amplifier processing method or a voltage analog processing method is usually used to implement the power-off detection function. On the one hand, a large number of complex electronic components and a supercapacitor backup power supply are required. The circuit design is complex and the cost is relatively high. On the other hand, it is not suitable for power isolation scenarios. Based on this, it is difficult to efficiently and scenario-adaptively implement the power-off detection function of the power supply voltage. Summary of the invention
[0004] Based on this, it is necessary to provide a power-off detection circuit, a data storage method based on the power-off detection circuit, a computer device and a computer-readable storage medium to address the above-mentioned technical problems, so as to realize power-off detection of the power supply voltage in a scenario-appropriate and efficient manner and effectively realize data storage under power-off conditions.
[0005] In a first aspect, the present application provides a power failure detection circuit, the power failure detection circuit comprising a main power module, a power energy storage module, a core function module, a non-core function module and a power failure detection module; The first output end of the main power module is connected to the power receiving end of the core function module, and the power storage module is connected to the connection line between the first output end of the main power module and the power receiving end of the core function module; The first output end of the main power module is connected to the first input end of the power failure detection module, the second output end of the main power module is connected to the second input end of the power failure detection module, the first output end of the power failure detection module is connected to the signal receiving end of the core function module, and the second output end of the power failure detection module is connected to the power receiving end of the non-core function module; When the power failure detection module detects that the power supply voltage output by the main power supply module is normal, the power failure detection module switches on the connection line between the main power supply module and the non-core function module, and the main power supply module provides electric energy to the non-core function module, the core function module and the power storage module, so that the non-core function module and the core function module are in a working state, and the power storage module is in a charging state; When the power-off detection module detects that the power supply voltage output by the main power module is abnormal, the power-off detection module disconnects the connection line between the main power module and the non-core function module to put the non-core function module in a shutdown state, the power storage module provides power to the core function module to keep the core function module in a working state, and the power-off detection module generates an interrupt signal and sends it to the core function module to enable the core function module to store and process data.
[0006] In a second aspect, the present application further provides a data storage method based on a power-off detection circuit, which is applied to the power-off detection circuit, wherein the power-off detection circuit includes a main power module, a power storage module, a core function module, a non-core function module, and a power-off detection module; the method includes: when the power-off detection module detects that the power voltage output by the main power module is normal, the power-off detection module conducts the connection line between the main power module and the non-core function module, and the main power module provides power to the non-core function module, the core function module, and the power storage module, so that the non-core function module and the core function module are in a working state, and the power storage module is in a charging state; When the power-off detection module detects that the power supply voltage output by the main power module is abnormal, the power-off detection module disconnects the connection line between the main power module and the non-core function module to put the non-core function module in a shutdown state, the power storage module provides power to the core function module to keep the core function module in a working state, and the power-off detection module generates an interrupt signal and sends it to the core function module to enable the core function module to store and process data.
[0007] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the above steps when executing the computer program.
[0008] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the above steps when executed by a processor.
[0009] The power failure detection circuit, the data storage method based on the power failure detection circuit, the computer device and the computer-readable storage medium detect the power supply voltage output from the first output end of the main power supply module through the power failure detection module, and control the power supply voltage output from the second output end of the main power supply module, so as to adaptively realize efficient control of the power supply component and the power receiving component in the power failure detection circuit in an electrical isolation scenario or a non-isolation scenario; that is, when the power failure detection module detects that the power supply voltage is normal, it ensures that the core function module and the non-core function module are in a working state, and the power storage module is in a charging state, so as to ensure the overall normal operation of the circuit system and to prepare for energy storage for possible power failure abnormal conditions; when the power supply voltage abnormality is detected, the power failure detection module disconnects the non-core function module from the main power supply module, and the power storage module provides power to the non-core function module to reduce unnecessary power consumption, and then the power failure detection module sends an interrupt signal to the core function module to realize efficient and effective data storage and processing based on the core function module that maintains the working state under the power failure abnormal condition, so as to avoid data loss or storage error. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0011] Figure 1 is a schematic diagram of the structure of a power failure detection circuit in one embodiment; Figure 2 A schematic diagram of the structure of a core functional module in a power failure detection circuit in one embodiment; Figure 3 The figure is a schematic diagram of the structure of a power failure detection module in a power failure detection circuit in one embodiment; Figure 4 A schematic diagram of the structure of a power failure detection module in a power failure detection circuit in another embodiment; Figure 5 It is a schematic diagram of the structure of a power supply energy storage module in a power failure detection circuit in one embodiment; Figure 6 It is a structural schematic diagram of a main power supply module and a power supply energy storage module in a power failure detection circuit in one embodiment; Figure 7 A schematic diagram of the structure of a communication module in an embodiment; Figure 8 A schematic diagram of the structure of a power failure detection circuit in another embodiment; Fig. 9 The figure is a flow chart of a data storage method based on a power failure detection circuit in one embodiment. DETAILED DESCRIPTION
[0012] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0013] In an exemplary embodiment, Figure 1 As shown, a power failure detection circuit is provided, which includes a main power module 100 , a power storage module 200 , a core function module 300 , a non-core function module 400 and a power failure detection module 500 .
[0014] Among them, the main power supply module 100 is used to provide input power; the power storage module 200 is used to store electrical energy to provide backup power when the input power is abnormal; the core function module 300 is used to perform core operations such as data storage, calculation, and control that affect the normal operation of the circuit system, and the circuit system represents all hardware and software components corresponding to the entire circuit; the non-core function module 400 is used to perform non-core operations that do not directly affect the circuit system except for core operations such as data storage, calculation, and control that affect the normal operation of the circuit system; the power-off detection module 500 is used to detect the power supply voltage and control the power supply switching of the circuit.
[0015] The first output end of the main power module 100 is connected to the power receiving end of the core function module 300 , and the power storage module 200 is connected to the connection line between the first output end of the main power module 100 and the power receiving end of the core function module 300 .
[0016] The first output end of the main power supply module 100 is connected to the first input end of the power off detection module 500, the second output end of the main power supply module 100 is connected to the second input end of the power off detection module 500, the first output end of the power off detection module 500 is connected to the signal receiving end of the core function module 300, and the second output end of the power off detection module 500 is connected to the power receiving end of the non-core function module 400.
[0017] Exemplarily, when the power-off detection module 500 detects that the power voltage output by the main power module 100 at the first output terminal is normal, the power-off detection module 500 turns on the connection line between the main power module 100 and the non-core function module 400, and the main power module 100 provides power to the non-core function module 400 through the power voltage output by its second output terminal and the turned-on power-off detection module 500, provides power to the core function module 300 through the power voltage output by its first output terminal, and provides power to the power storage module 200 through the power voltage output by its first output terminal, so that the non-core function module 400 and the core function module 300 are in a working state, and the power storage module 200 is in a charging state.
[0018] Exemplarily, when the power-off detection module 500 detects that the power voltage output by the main power module 100 at the first output terminal is abnormal, the power-off detection module 500 disconnects the connection line between the main power module 100 and the non-core function module 400 to put the non-core function module 400 in a shutdown state, the power storage module 200 provides power to the core function module 300 to keep the core function module 300 in a working state, and the power-off detection module 500 generates an interrupt signal and sends it to the core function module 300 to enable the core function module 300 to store and process the data.
[0019] The interrupt signal represents a signal generated by the power failure detection module 500 when detecting that the power supply voltage outputted from the first output terminal of the main power supply module 100 is abnormal, and is used to prompt the core function module 300 to perform data storage processing to avoid data loss due to power failure.
[0020] Among them, the power supply voltage at the first output end of the main power supply module 100 represents the reference voltage provided for the voltage detection of the power-off detection module 500; the power supply voltage at the second output end of the main power supply module 100 represents the working voltage provided for the operation of the non-core functional module 400. Further, the power supply voltage at the second output end of the main power supply module 100 also represents the working voltage provided for the operation of the core functional module 300. That is, the second output end of the main power supply module 100 can be connected to the power receiving end of the core functional module 300 to directly provide power to the core functional module 300, or the power supply voltage outputted from the first output end of the main power supply module 100 can be converted to obtain the power supply voltage corresponding to the second output end of the main power supply module 100 and transmitted to the core functional module 300.
[0021] In this embodiment, the power supply voltage output from the first output end of the main power supply module is detected by the power failure detection module, and the power supply voltage output from the second output end of the main power supply module is controlled, so that the power supply component and the power receiving component in the power failure detection circuit can be adaptively controlled in an electrically isolated scenario or a non-isolated scenario; that is, when the power failure detection module detects that the power supply voltage is normal, it is ensured that the core function module and the non-core function module are in a working state, and the power storage module is in a charging state, so as to ensure the overall normal operation of the circuit system and to prepare for energy storage for possible power failure abnormal conditions; when the power supply voltage abnormality is detected, the power failure detection module disconnects the non-core function module from the main power supply module, and the power storage module provides power to the non-core function module to reduce unnecessary power consumption, and then the power failure detection module sends an interrupt signal to the core function module to realize efficient and effective storage and processing of data based on the core function module that maintains a working state under the power failure abnormal condition, so as to avoid data loss or storage errors.
[0022] In an exemplary embodiment, Figure 2 As shown, the core functional module 300 includes a main control unit 301 and a storage unit 302 which are connected to each other.
[0023] Among them, the main control unit 301 represents a logic processor or controller for executing the core operations of the circuit system, such as a microcontroller (MCU), a digital signal processor (DSP) or a single-chip microcomputer; the storage unit 302 represents a storage device for storing data in the circuit system, such as a non-volatile storage device such as a Flash memory, EEPROM or NV-RAM.
[0024] Among them, the first output end of the main power module 100 is connected to the main control unit 301 and the storage unit 302 respectively, the power storage module 200 is connected to the main control unit 301 and the storage unit 302 respectively, and the first output end of the power failure detection module 500 is connected to the main control unit 301.
[0025] Exemplarily, when the power-off detection module 500 detects that the power supply voltage output by the main power supply module 100 is abnormal, the power-off detection module 500 generates an interrupt signal and sends it to the main control unit 301; after receiving the interrupt signal, the main control unit 301 terminates the current running task and sends data to the storage unit 302 so that the storage unit 302 stores the data.
[0026] Among them, the currently terminated running task means the currently executing task corresponding to the non-core operation, that is, the task that is not the highest priority when the power is off, such as the tasks corresponding to the communication, display refresh and other operations. After terminating the current running task, the main control unit generates a high-priority power-off protection task to store key data in the circuit system, such as system running status data, equipment configuration data and other data that affect the system function; according to the stored key data, in the subsequent power-on process, it is ensured that the circuit system can be restored to the running state before the power failure.
[0027] In this embodiment, under the abnormal power failure condition, the main control unit and the storage unit in the core functional module are ensured to remain in a working state, that is, the availability of the basic functional components that perform core operations in the circuit system is ensured, and the interrupt signal of the power failure detection module is received and processed by the main control unit, so as to efficiently realize the task management of the main control unit under the abnormal power failure condition, and realize data storage processing based on the storage unit according to useful task resources.
[0028] In an exemplary embodiment, Figure 3 As shown, the power-off detection module 500 includes a voltage detection unit 501 and a current control unit 502 .
[0029] Among them, the voltage detection unit 501 is used to detect the power supply voltage output by the first output end of the main power supply module 100; the current control unit 502 is used to turn on or off the connection line between the second output end of the main power supply module 100 and the non-core functional module 400 according to the voltage detection result of the voltage detection unit 501.
[0030] Among them, the input end of the voltage detection unit 501 is connected to the first output end of the main power module 100, the output end of the voltage detection unit 501 is connected to the input end of the current control unit 502, the input end of the current control unit 502 is connected to the second output end of the main power module 100, the first output end of the current control unit 502 is connected to the signal receiving end of the core function module 300, and the second output end of the current control unit 502 is connected to the power receiving end of the non-core function module 400.
[0031] Exemplarily, when the voltage detection unit 501 detects that the power voltage outputted from the first output terminal of the main power module 100 is normal, the current control unit 502 conducts the connection line between the second output terminal of the main power module 100 and the non-core functional module 400, so that the non-core functional module 400 receives the electric energy outputted from the second output terminal of the main power module 100 through the second output terminal of the current control unit 502. When the voltage detection unit 501 detects that the power voltage outputted from the first output terminal of the main power module 100 is abnormal, the current control unit 502 blocks the connection line between the second output terminal of the main power module 100 and the non-core functional module 400, and generates an interrupt signal by the current control unit 502 and sends it to the signal receiving terminal of the core functional module 300 through its first output terminal.
[0032] In this embodiment, in the power-off detection module, the power-off detection module is adaptively functionally split to obtain a voltage detection unit for detecting the power supply voltage and a current control unit for controlling the on-off of the connection line. Based on the signal transmission and functional coordination between the voltage detection unit and the current control unit, the power supply detection and control functions in the power-off detection application scenario are efficiently realized.
[0033] In an exemplary embodiment, Figure 4 As shown, the voltage detection unit 501 includes a voltage stabilizing diode VD1 and a first resistor R1 , and the current control unit 502 includes an optical coupler U1 , a P-type field effect transistor Q1 and a second resistor R2 .
[0034] Among them, the voltage-stabilizing diode VD1 is used to detect the power supply voltage output by the first output terminal of the main power supply module 100, and control the state of the optocoupler U1 according to the voltage detection result; the optocoupler U1 is used to realize the electrical isolation function of the power-off detection module 500 and control the state of the P-type field effect transistor Q1 according to its current state; the P-type field effect transistor Q1 is used to control the on-off of the connection line between the second output terminal of the main power supply module 100 and the non-core functional module 400 according to its own state; the first resistor R1 is used to limit the current flowing through the voltage-stabilizing diode VD1 and the optocoupler U1 to ensure that the voltage-stabilizing diode VD1 and the optocoupler U1 operate within a safe current range; the second resistor R2 is used to provide a pull-up function for the output terminal of the optocoupler U1.
[0035] Among them, the cathode of the voltage-stabilizing diode VD1 is connected to the first output end of the main power module 100 through the first resistor R1, the input anode of the optocoupler U1 is connected to the positive electrode of the voltage-stabilizing diode VD1, the input cathode of the optocoupler U1 is grounded PGND, the output collector of the optocoupler U1 is respectively connected to the signal receiving end of the core function module 300, connected to the gate of the P-type field effect transistor Q1, and respectively connected to the second output end of the main power module 100 and the source of the P-type field effect transistor Q1 through the second resistor R2, the output emitter of the optocoupler U1 is grounded GND, and the drain of the P-type field effect transistor Q1 is connected to the power receiving end of the non-core function module 400.
[0036] Exemplarily, when the power supply voltage outputted from the first output terminal of the main power supply module 100 is greater than or equal to a preset voltage threshold, the voltage regulator diode VD1 is in the on state so that the optocoupler U1 is in the on state, and the power-off detection signal S1 generated by the output collector of the optocoupler U1 is a low-level signal, and the low-level signal is sent to the gate of the P-type field effect transistor Q1 so that the P-type field effect transistor Q1 is set to the on state based on the low-level signal, and the main power supply module 100 provides power to the non-core functional module 400 based on the P-type field effect transistor Q1 in the on state, so that the non-core functional module 400 is in a working state.
[0037] Exemplarily, when the power supply voltage outputted from the first output terminal of the main power supply module 100 is less than a preset voltage threshold, the voltage regulator diode VD1 is in a blocking state so that the optocoupler U1 is in a blocking state, and the power-off detection signal S1 generated by the output collector of the optocoupler U1 is a high-level signal, and the high-level signal is sent to the gate of the P-type field effect transistor Q1 so that the P-type field effect transistor Q1 is set to a blocking state based on the high-level signal, and the main power supply module 100 stops providing power to the non-core functional module 400 based on the P-type field effect transistor Q1 in the blocking state so that the non-core functional module 400 is in a closed state; the optocoupler U1 uses the high-level signal as an interrupt signal and sends it to the core functional module 300 so that the core functional module 300 stores and processes the data.
[0038] In this embodiment, in the power-off detection module, based on the connection relationship and functional coordination relationship between the voltage-stabilizing diode, the optocoupler, and the P-type field-effect transistor, the detected power supply voltage anomaly is sequentially converted into the real-time status corresponding to each component, thereby accurately, effectively, and mutually influencing the construction of associated connection lines for voltage detection and current control of the main power module and interruption reminder of the core functional module, and the power-off detection, current control, and interruption reminder functions can be effectively realized without a large number of complex electronic components.
[0039] In an exemplary embodiment, Figure 5 As shown, the power storage module 200 includes a first capacitor C1, a second capacitor C2 and a diode D1.
[0040] Among them, the first capacitor C1 is used to filter out the interference of the power storage module 200 on the power-off detection module 500, so as to prevent the power-off detection module 500 from misjudging the power supply voltage condition; the second capacitor C2 is used to store electric energy when the power supply voltage of the main power module 100 is normal, and to provide electric energy for the core function module 300 when the power supply voltage of the main power module 100 is abnormal; the diode D1 is used to realize unidirectional power supply of the main power module 100 and the power storage module 200.
[0041] Among them, the anode of the diode D1 is connected to the first output end of the main power module 100, and the cathode of the diode D1 is connected to the power receiving end of the core function module 300; one end of the first capacitor C1 is connected to the connection line between the anode of the diode D1 and the first output end of the main power module 100, and the other end of the first capacitor C1 is grounded GND; one end of the second capacitor C2 is connected to the connection line between the cathode of the diode D1 and the power receiving end of the core function module 300, and the other end of the second capacitor C2 is grounded GND.
[0042] Exemplarily, when the power supply voltage of the main power supply module 100 is normal, the main power supply module 100 provides electrical energy to the core function module 300 and the second capacitor C2 respectively based on the unidirectional power supply direction determined by the diode D1, so that the core function module 300 is in a working state and the second capacitor C2 is in a charging state; when the power supply voltage of the main power supply module 100 is abnormal, the second capacitor C2 is in a discharging state, and the second capacitor C2 provides electrical energy to the core function module 300 based on the unidirectional power supply direction determined by the diode D1, so that the core function module 300 remains in a working state; the first capacitor C1 filters out the interference of the second capacitor C2 to the power-off detection module 500.
[0043] In this embodiment, in the power storage module, based on the connection mode and functional coordination between the first capacitor, the diode and the second capacitor, the effective energy storage, unidirectional power supply and interference filtering functions are effectively and efficiently realized during the power supply process, thereby improving the effectiveness and applicability of stored electrical energy in the power-off detection scenario.
[0044] In an exemplary embodiment, Figure 6 As shown, the main power module 100 includes a first power unit Vin, a second power unit Vdd and a power conversion unit 101 .
[0045] Among them, the first power supply unit Vin is used to provide a reference voltage for voltage detection of the power-off detection module 500; the second power supply unit Vdd is used to provide an operating voltage for the operation of the core function module 300 and the non-core function module 400; the power conversion unit 101 is used to convert the power supply voltage output by the first power supply unit Vin to obtain the power supply voltage corresponding to the second power supply unit Vdd and transmit it to the core function module 300.
[0046] The input end of the power conversion unit 101 is connected to the cathode of the diode D1, the anode of the diode D1 is connected to the output end of the first power unit Vin, and the output end of the power conversion unit 101 is respectively connected to the power receiving end of the core function module 300 and the output end of the second power unit Vdd.
[0047] Among them, the output end of the first power supply unit Vin is also connected to the first input end of the power-off detection module 500, so that the power-off detection module 500 detects the power supply voltage output by the first power supply unit Vin; the output end of the second power supply unit Vdd is also connected to the second input end of the power-off detection module 500, so that the power-off detection module 500 controls the on-off of the connection line between the second power supply unit Vdd and the non-core functional module 400.
[0048] Exemplarily, the number of the second capacitors C2 is at least two (eg Figure 6 In the connection line between the output terminal of the first power supply unit Vin and the anode of the diode D1, a first capacitor C1 is connected, and the other end of the first capacitor C1 is grounded PGND; in the connection line between the cathode of the diode D1 and the input terminal of the power conversion unit 101, at least one second capacitor C2 (such as Figure 6 C21 as shown), and the other end of the second capacitor C21 is grounded PGND; in the connection line between the output end of the power conversion unit 101 and the power receiving end of the core functional module 300, at least one second capacitor C2 (as shown Figure 6 The second capacitor C22 and the second capacitor C23 are connected in parallel as shown, and the other ends of the second capacitor C22 and the second capacitor C23 are grounded GND.
[0049] Exemplarily, the second capacitor C21 in the connection line between the cathode of the diode D1 and the input end of the power conversion unit 101 receives electric energy from the first power supply unit Vin, and the second capacitor C22 and the second capacitor C23 in the connection line between the output end of the power conversion unit 101 and the power receiving end of the core function module 300 receive electric energy from the second power supply unit Vdd. The power conversion unit 101 converts the electric energy from the first power supply unit Vin or electrically isolates the first power supply unit Vin from the second power supply unit Vdd.
[0050] Exemplarily, when a power failure occurs, the electric energy stored in the second capacitor C21 is converted into electric energy suitable for the core function module 300 by the power conversion unit 101 and transmitted to the core function module 300, and the electric energy stored in the second capacitor C22 and the second capacitor C23 is directly transmitted to the core function module 300, and the core function module 300 maintains a working state according to the received electric energy.
[0051] Optionally, the total number of the second capacitors C2 and the number of connections in different connection lines may be adaptively determined according to the power demand of the core functional module 300 and the power supply capabilities of the first power supply unit Vin and the second power supply unit Vdd.
[0052] In this embodiment, in the case of multiple types of power supply settings including a first power supply unit and a second power supply unit, the overall connection line between the output end of the power supply voltage and the power receiving end of the core functional module is divided by the power conversion unit, and the second capacitor is adaptively connected based on the different connection lines obtained by the division, so that the second capacitor stores and supplies electric energy in the corresponding connection line, thereby ensuring the diversity of power storage types and energy adequacy.
[0053] In an exemplary embodiment, Figure 7 As shown, the power-off detection circuit further includes a communication module; the communication module includes a third resistor R3.
[0054] The first ground terminal PGND provides a ground reference for the power voltage outputted from the first output terminal of the main power module 100 , and the second ground terminal PGND provides a ground reference for the power voltage outputted from the second output terminal of the main power module 100 .
[0055] Exemplarily, the resistance of the third resistor R3 is 0, and the third resistor R3 is respectively connected to the first ground terminal PGND and the second ground terminal PGND, so that the voltage between the first ground terminal PGND and the second ground terminal GND is guaranteed to be consistent, thereby realizing the power-off detection, power storage and supply functions of the power-off detection circuit in a non-electrical isolation scenario.
[0056] Optionally, in an electrical isolation scenario, there is no need for a connecting module to connect the first ground terminal PGND and the second ground terminal GND to ensure that the circuits corresponding to the first output terminal and the second output terminal of the main power module 100 are in an electrically isolated state to reduce the possibility of mutual interference.
[0057] In this embodiment, based on the interconnection module, the circuits corresponding to different output ends of the main power module are interconnected to realize the functions of power-off detection, power storage and supply of the power-off detection circuit in non-electrical isolation scenarios, simplifying the circuit design and avoiding interference problems caused by ground potential differences, thereby improving the accuracy and efficiency of data processing of the power-off detection circuit.
[0058] In an exemplary embodiment, Figure 8 As shown, a power failure detection circuit is also provided, which includes a main power module 100 , a power storage module 200 , a core function module 300 , a non-core function module 400 and a power failure detection module 500 .
[0059] Among them, the main power supply module 100 includes a first power supply unit Vin, a second power supply unit Vdd and a power conversion unit 101; the power storage module 200 includes a first capacitor C1, a second capacitor C21, a second capacitor C22, a second capacitor C23 and a diode D1; the core function module 300 includes a main control unit 301 and a storage unit 302; the non-core function module 400 includes a load unit 401, and the load unit 401 is used to perform auxiliary or non-critical tasks in the circuit system; the power failure detection module 500 includes a voltage regulator diode VD1, a first resistor R1, an optocoupler U1, a P-type field effect transistor Q1 and a second resistor R2.
[0060] The output end of the first power supply unit Vin is connected to the positive electrode of the diode D1, the negative electrode of the diode D1 is connected to the input end of the power conversion unit 101, the output end of the power conversion unit 101 is respectively connected to the main control unit 301 and the storage unit 302, and the output end of the second power supply unit Vdd is respectively connected to the main control unit 301 and the storage unit 302. In the connection line between the output end of the first power supply unit Vin and the positive electrode of the diode D1, the first capacitor C1 is connected, and the other end of the first capacitor C1 is grounded PGND; in the connection line between the negative electrode of the diode D1 and the input end of the power conversion unit 101, the second capacitor C21 is connected, and the other end of the second capacitor C21 is grounded PGND. In the connection line between the output end of the power conversion unit 101 and the main control unit 301, the second capacitor C22 and the second capacitor C23 are connected in parallel, and the other ends of the second capacitor C22 and the second capacitor C23 are grounded GND.
[0061] Among them, the cathode of the voltage-stabilizing diode VD1 is connected to the output end of the first power supply unit Vin through the first resistor R1, the input anode of the optocoupler U1 is connected to the positive electrode of the voltage-stabilizing diode VD1, the input cathode of the optocoupler U1 is grounded PGND, the output collector of the optocoupler U1 is respectively connected to the main control unit 301 (the connection path is not shown in the figure), connected to the gate of the P-type field effect transistor Q1, and respectively connected to the output end of the second power supply unit Vdd and the source of the P-type field effect transistor Q1 through the second resistor R2, the output emitter of the optocoupler U1 is grounded GND, and the drain of the P-type field effect transistor Q1 is connected to the load unit 401.
[0062] Exemplarily, when the power supply voltage outputted from the output end of the first power supply unit Vin is greater than or equal to a preset voltage threshold, the voltage regulator diode VD1 is in the on state so that the optocoupler U1 is in the on state, and the power-off detection signal S1 generated by the output collector of the optocoupler U1 is a low-level signal, and the low-level signal is sent to the gate of the P-type field effect transistor Q1 so that the P-type field effect transistor Q1 is set to the on state based on the low-level signal, and the second power supply unit Vdd provides electrical energy to the load unit 401 based on the P-type field effect transistor Q1 in the on state, so that the load unit 401 is in a working state.
[0063] Furthermore, the second capacitor C21 in the connection line between the cathode of the diode D1 and the input end of the power conversion unit 101 receives the electric energy from the first power unit Vin to be in a charging state, and the second capacitor C22 and the second capacitor C23 in the connection line between the output end of the power conversion unit 101 and the main control unit 301 receive the electric energy from the second power unit Vdd to be in a charging state. The power conversion unit 101 converts the electric energy from the first power unit Vin into electric energy suitable for the main control unit 301 and the storage unit 302 and transmits it to the main control unit 301 and the storage unit 302, and the electric energy output by the second power unit Vdd is directly transmitted to the main control unit 301 and the storage unit 302, so that the main control unit 301 and the storage unit 302 are in a working state according to the received electric energy.
[0064] Exemplarily, when the power supply voltage outputted from the output end of the first power supply unit Vin is less than a preset voltage threshold, the voltage regulator diode VD1 is in a blocking state so that the optocoupler U1 is in a blocking state, and the power-off detection signal S1 generated by the output collector of the optocoupler U1 is a high-level signal, and the high-level signal is sent to the gate of the P-type field effect transistor Q1 so that the P-type field effect transistor Q1 is set to a blocking state based on the high-level signal, and the second power supply unit Vdd stops providing power to the load unit 401 based on the P-type field effect transistor Q1 in the blocking state, so that the load unit 401 is in a closed state.
[0065] Furthermore, the electric energy stored in the second capacitor C21 is converted into electric energy suitable for the main control unit 301 and the storage unit 302 by the power conversion unit 101 and transmitted to the main control unit 301 and the storage unit 302, and the electric energy stored in the second capacitor C22 and the second capacitor C23 is directly transmitted to the main control unit 301 and the storage unit 302, so that the main control unit 301 and the storage unit 302 maintain the working state according to the received electric energy. The optical coupler U1 sends the high-level signal as an interrupt signal to the main control unit 301, so that the main control unit 301 in the working state stops the current operation task and stores the data in the storage unit 302 in the working state.
[0066] Optionally, a third capacitor C3 can be connected in the connection line between the drain of the P-type field effect transistor Q1 and the load unit 401, and the other end of the third capacitor C3 is grounded GND; the third capacitor C3 is used to store electrical energy from the second power supply unit Vdd when the power supply voltage is normal, and to provide electrical energy to the main control unit 301 and the storage unit 302 when the power supply voltage is abnormal (the connection path is not shown in the figure).
[0067] Each module in the above power failure detection circuit can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0068] Based on the same inventive concept, the embodiment of the present application also provides a data storage method based on a power failure detection circuit implemented according to the power failure detection circuit involved above. The implementation scheme for solving the problem provided by the method is similar to the implementation scheme recorded in the above-mentioned device, so the specific limitations in one or more data storage method embodiments based on a power failure detection circuit provided below can refer to the limitations of the power failure detection circuit above, and will not be repeated here.
[0069] In an exemplary embodiment, Fig. 9 As shown, a data storage method based on a power-off detection circuit is provided. This embodiment takes the method applied to the above-mentioned power-off detection circuit as an example. The power-off detection circuit includes a main power module, a power storage module, a core function module, a non-core function module and a power-off detection module; the method includes the following steps S901 to S902.
[0070] Step S901, when the power failure detection module detects that the power supply voltage output by the main power supply module is normal, the power failure detection module switches on the connection line between the main power supply module and the non-core function module, and the main power supply module provides power to the non-core function module, the core function module and the power storage module, so that the non-core function module and the core function module are in working state, and the power storage module is in charging state.
[0071] Step S902, when the power failure detection module detects that the power supply voltage output by the main power supply module is abnormal, the power failure detection module disconnects the connection line between the main power supply module and the non-core functional module to put the non-core functional module in a closed state, the power storage module provides power to the core functional module to keep the core functional module in a working state, and the power failure detection module generates an interrupt signal and sends it to the core functional module to enable the core functional module to store and process the data.
[0072] In an exemplary embodiment, the core functional module includes a main control unit and a storage unit connected to each other; the method also includes: when the power-off detection module detects that the power supply voltage output by the main power module is abnormal, the power-off detection module generates an interrupt signal and sends it to the main control unit; after receiving the interrupt signal, the main control unit terminates the current running task and sends the data to the storage unit so that the storage unit stores the data.
[0073] In an exemplary embodiment, the power-off detection module includes a voltage detection unit and a current control unit; the method also includes: when the voltage detection unit detects that the power voltage output by the main power module is normal, the current control unit turns on the connection line between the main power module and the non-core functional module; when the voltage detection unit detects that the power voltage output by the main power module is abnormal, the current control unit blocks the connection line between the main power module and the non-core functional module.
[0074] In an exemplary embodiment, the voltage detection unit includes a voltage regulator diode and a first resistor, and the current control unit includes an optocoupler, a P-type field effect transistor and a second resistor; the method also includes: when the power supply voltage output by the main power module is greater than or equal to a preset voltage threshold, the voltage regulator diode and the optocoupler are in a conducting state, the output collector of the optocoupler generates a low-level signal and sends it to the source of the P-type field effect transistor, the P-type field effect transistor is set to a conducting state based on the low-level signal, and the main power module provides power to the non-core function module based on the P-type field effect transistor in the conducting state, so that the non-core function module is in a working state; when the power supply voltage output by the main power module is less than the preset voltage threshold, the voltage regulator diode and the optocoupler are in a blocking state, the output collector of the optocoupler generates a high-level signal and sends it to the source of the P-type field effect transistor, the P-type field effect transistor is set to a blocking state based on the high-level signal, and the main power module stops providing power to the non-core function module based on the P-type field effect transistor in the blocking state, so that the non-core function module is in a closed state; the optocoupler uses the high-level signal as an interrupt signal and sends it to the core function module so that the core function module stores and processes the data.
[0075] In an exemplary embodiment, the power energy storage module includes a first capacitor, a second capacitor and a diode; the method also includes: the first capacitor filters out the interference of the power energy storage module to the power-off detection module; the second capacitor stores electric energy when the power voltage of the main power module is normal, and provides electric energy to the core functional module when the power voltage of the main power module is abnormal; the diode realizes unidirectional power supply of the main power module and the power energy storage module.
[0076] In an exemplary embodiment, the main power supply module includes a first power supply unit, a second power supply unit and a power conversion unit; the method also includes: a second capacitor in a connection line between the cathode of the diode and the input end of the power conversion unit receives electric energy from the first power supply unit, a second capacitor in a connection line between the output end of the power conversion unit and the power receiving end of the core functional module receives electric energy from the second power supply unit, and the power conversion unit converts the electric energy of the first power supply unit or electrically isolates the first power supply unit from the second power supply unit.
[0077] In an exemplary embodiment, the power-off detection circuit further includes a communication module; the method further includes: the communication module is respectively connected to the first ground terminal and the second ground terminal to ensure that the voltage between the first ground terminal and the second ground terminal is consistent.
[0078] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0079] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in any of the above embodiments when executing the computer program.
[0080] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in any of the above embodiments are implemented.
[0081] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0082] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0083] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be construed as limiting the scope of the present application. It should be noted that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A power failure detection circuit, characterized in that: The power failure detection circuit includes a main power module, a power energy storage module, a core function module, a non-core function module and a power failure detection module; The first output end of the main power module is connected to the power receiving end of the core function module, and the power storage module is connected to the connection line between the first output end of the main power module and the power receiving end of the core function module; The first output end of the main power module is connected to the first input end of the power failure detection module, the second output end of the main power module is connected to the second input end of the power failure detection module, the first output end of the power failure detection module is connected to the signal receiving end of the core function module, and the second output end of the power failure detection module is connected to the power receiving end of the non-core function module; When the power failure detection module detects that the power supply voltage output by the main power supply module is normal, the power failure detection module switches on the connection line between the main power supply module and the non-core function module, and the main power supply module provides electric energy to the non-core function module, the core function module and the power storage module, so that the non-core function module and the core function module are in a working state, and the power storage module is in a charging state; When the power-off detection module detects that the power supply voltage output by the main power module is abnormal, the power-off detection module disconnects the connection line between the main power module and the non-core function module to put the non-core function module in a shutdown state, the power storage module provides power to the core function module to keep the core function module in a working state, and the power-off detection module generates an interrupt signal and sends it to the core function module to enable the core function module to store and process data.
2. The power-off detection circuit according to claim 1, characterized in that: The core functional module includes a main control unit and a storage unit connected to each other; The first output end of the main power supply module is connected to the main control unit and the storage unit respectively, the power storage module is connected to the main control unit and the storage unit respectively, and the first output end of the power failure detection module is connected to the main control unit; When the power failure detection module detects that the power supply voltage output by the main power supply module is abnormal, the power failure detection module generates an interrupt signal and sends it to the main control unit; After receiving the interrupt signal, the main control unit stops the current running task and sends the data to the storage unit so that the storage unit stores the data.
3. The power-off detection circuit according to claim 1, characterized in that: The power-off detection module includes a voltage detection unit and a current control unit; The input end of the voltage detection unit is connected to the first output end of the main power module, the output end of the voltage detection unit is connected to the input end of the current control unit, the input end of the current control unit is connected to the second output end of the main power module, and the output end of the current control unit is connected to the power receiving end of the non-core functional module; When the voltage detection unit detects that the power supply voltage output by the main power supply module is normal, the current control unit switches on the connection line between the main power supply module and the non-core functional module; When the voltage detection unit detects that the power voltage output by the main power module is abnormal, the current control unit blocks the connection line between the main power module and the non-core functional module.
4. The power-off detection circuit according to claim 3, characterized in that: The voltage detection unit includes a voltage stabilizing diode and a first resistor, and the current control unit includes an optocoupler, a P-type field effect transistor and a second resistor; The cathode of the voltage-stabilizing diode is connected to the first output terminal of the main power module through the first resistor, the input anode of the optocoupler is connected to the positive electrode of the voltage-stabilizing diode, the input cathode of the optocoupler is grounded, the output collector of the optocoupler is respectively connected to the signal receiving terminal of the core function module, connected to the gate of the P-type field effect transistor, and respectively connected to the second output terminal of the main power module and the source of the P-type field effect transistor through the second resistor, the output emitter of the optocoupler is grounded, and the drain of the P-type field effect transistor is connected to the power receiving terminal of the non-core function module; When the power supply voltage output by the main power module is greater than or equal to a preset voltage threshold, the voltage stabilizing diode and the optocoupler are in a conducting state, the output collector of the optocoupler generates a low-level signal and sends it to the source of the P-type field effect transistor, the P-type field effect transistor is set to a conducting state based on the low-level signal, and the main power module provides power to the non-core function module based on the P-type field effect transistor in a conducting state, so that the non-core function module is in a working state; When the power supply voltage output by the main power module is less than a preset voltage threshold, the voltage regulator diode and the optocoupler are in a blocking state, the output collector of the optocoupler generates a high-level signal and sends it to the source of the P-type field effect transistor, and the P-type field effect transistor is set to a blocking state based on the high-level signal. The main power module stops providing power to the non-core functional module based on the P-type field effect transistor in the blocking state, so that the non-core functional module is in a closed state; the optocoupler uses the high-level signal as an interrupt signal and sends it to the core functional module so that the core functional module stores and processes the data.
5. The power-off detection circuit according to claim 1, characterized in that: The power storage module includes a first capacitor, a second capacitor and a diode; The anode of the diode is connected to the first output terminal of the main power module, and the cathode of the diode is connected to the power receiving terminal of the core function module; The first capacitor is connected to the connection line between the positive electrode of the diode and the first output end of the main power module, and the second capacitor is connected to the connection line between the negative electrode of the diode and the power receiving end of the core function module; The first capacitor is used to filter out interference of the power storage module to the power failure detection module; The second capacitor is used to store electric energy when the power supply voltage of the main power supply module is normal, and to provide electric energy to the core function module when the power supply voltage of the main power supply module is abnormal; The diode is used to realize unidirectional power supply of the main power module and the power storage module.
6. The power-off detection circuit according to claim 5, characterized in that: The main power supply module includes a first power supply unit, a second power supply unit and a power conversion unit; The input end of the power conversion unit is connected to the cathode of the diode, the anode of the diode is connected to the output end of the first power unit, and the output end of the power conversion unit is respectively connected to the power receiving end of the core function module and the output end of the second power unit; The number of the second capacitors is at least two; the first capacitor is connected to the connection line between the output end of the first power supply unit and the positive electrode of the diode; at least one second capacitor is connected to the connection line between the negative electrode of the diode and the input end of the power conversion unit; At least one second capacitor is connected to a connection line between the output end of the power conversion unit and the power receiving end of the core function module; A second capacitor in the connection line between the cathode of the diode and the input end of the power conversion unit receives electric energy from the first power supply unit, and a second capacitor in the connection line between the output end of the power conversion unit and the power receiving end of the core functional module receives electric energy from the second power supply unit. The power conversion unit is used to convert the electric energy of the first power supply unit or to electrically isolate the first power supply unit from the second power supply unit.
7. The power failure detection circuit according to claim 1, characterized in that: The power failure detection circuit also includes a communication module; The first ground terminal provides a ground reference for the power supply voltage outputted by the first output terminal of the main power supply module, and the second ground terminal provides a ground reference for the power supply voltage outputted by the second output terminal of the main power supply module; The communication module is connected to the first ground terminal and the second ground terminal respectively, so that the voltage between the first ground terminal and the second ground terminal is guaranteed to be consistent.
8. A data storage method based on a power-off detection circuit, characterized in that: The power failure detection circuit according to any one of claims 1 to 7, wherein the power failure detection circuit comprises a main power supply module, a power energy storage module, a core function module, a non-core function module and a power failure detection module; The method comprises: When the power failure detection module detects that the power supply voltage output by the main power supply module is normal, the power failure detection module switches on the connection line between the main power supply module and the non-core function module, and the main power supply module provides electric energy to the non-core function module, the core function module and the power storage module, so that the non-core function module and the core function module are in a working state, and the power storage module is in a charging state; When the power-off detection module detects that the power supply voltage output by the main power module is abnormal, the power-off detection module disconnects the connection line between the main power module and the non-core function module to put the non-core function module in a shutdown state, the power storage module provides power to the core function module to keep the core function module in a working state, and the power-off detection module generates an interrupt signal and sends it to the core function module to enable the core function module to store and process data.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to claim 8 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to claim 8 are implemented.
Citation Information
Cited By
A power down protection system and method
CN122532840A