Open cover detection circuit integrated in MCU and open cover detection method based on MCU

By integrating the cover opening detection circuit in the MCU, using the real-time clock module and the cover opening detection module, the problem of high power consumption of traditional meter cover opening detection is solved, and low power consumption and high accuracy cover opening detection is achieved.

CN111323626BActive Publication Date: 2025-06-20SHENZHEN RENERGY TECH
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202010168884.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-03-12
Publication Date
2025-06-20
Estimated Expiration
2040-03-12

AI Technical Summary

Technical Problem

The traditional meter open cover detection method relies on CPU implementation, resulting in high power consumption and complex system, affecting the normal use of battery power.

Method used

A cover opening detection circuit integrated into the MCU is designed, including a real-time clock module, a cover opening detection module and a cover opening recording module. The level state change is detected through the MCU's cover opening detection pin, and the cover opening or closing event is determined using preset rules to reduce the participation of the CPU.

Benefits of technology

It realizes low-power cover open detection, avoids the power exhaustion caused by frequent CPU wake-up, and improves the accuracy of detection and the service life of the meter.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111323626B_ABST
    Figure CN111323626B_ABST
Patent Text Reader

Abstract

An open-cover detection circuit integrated in the MCU and an electric energy meter control chip are independently powered by the electric energy storage device of the electric meter. The real-time clock module and other modules can operate with low power consumption. Its power is low, ensuring that when the alternating current is cut off and only the electric energy storage device supplies power, the open-cover detection of the electric meter can still be carried out through the open-cover detection circuit of the MCU. In addition, the above method and circuit detect the change in the level state of the switch detection pin and determine whether there is an open-cover or close-cover event according to a preset rule. Setting the preset rule can avoid the mis-triggering of the interference signal on the switch detection pin, record the wrong open-cover or close-cover event, and improve the accuracy of open-cover detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of electric meters, and particularly relates to an electric meter control chip with an open - cover detection circuit having an independently - powered real - time clock circuit, an open - cover detection circuit integrated in an MCU, and an open - cover detection method based on an MCU. Background Art

[0002] The physical shell of an electric meter is the first line of defense against tampering. Its design must include a device that can detect when the meter shell is opened, so as to remind the service provider that the electric meter may have been subject to a tampering attack. Therefore, there is an open - cover detection design on general smart electric meters. When the upper cover of the electric meter is opened, the open - meter - cover detection switch inside the electric meter is triggered, and the electric meter records the open - meter - cover event. In the event - recording acquisition rules of the electric meter and the acquisition terminal, the open - cover event of the electric meter belongs to a level - 1 emergency event in the electric - meter events of the power - consumption information acquisition system event record. Its meaning is that it includes events where users have suspected electricity - stealing behaviors, and the acquisition strategy is to actively report to the master station system.

[0003] In traditional electric - meter open - cover detection methods, the CPU is used to detect the open - cover behavior and record the open - cover time, or the CPU reports the open - cover event to the master station system. The characteristic of this solution is that in the case of power failure of alternating current and only relying on battery power supply, the CPU needs to be frequently woken up to detect the open - cover event. By default, the CPU is in a sleep state. Whenever a key action is detected, the CPU needs to be woken up. The CPU determines whether there is an open - cover event, then records or reports the open - cover time, and then makes the CPU sleep again. However, because the function control of the CPU is relatively complex and the power consumption is relatively high, detecting the open - cover event through the CPU will affect the normal operation of the system in the case of battery passivation, causing the battery power to be exhausted prematurely. Summary of the Invention

[0004] The purpose of the present invention is to provide an open - cover detection circuit integrated in an MCU and an open - cover detection method based on an MCU, aiming to solve the problems of high power consumption and complex system existing in traditional open - cover detection based on a CPU.

[0005] The first aspect of the embodiment of the present invention provides an open - cover detection circuit integrated in an MCU. The MCU can be powered by an electric - energy storage device and includes:

[0006] A real - time clock module for providing real - time;

[0007] An open - cover detection module connected to the open - cover detection pin of the MCU, for detecting the change in the level state of the open - cover detection pin and determining whether there is an open - cover or close - cover event according to a preset rule, and for outputting a detection signal indicating the open - cover or close - cover event;

[0008] An open - cover recording module, connected to the open - cover detection module and the real - time clock module, is configured to receive the detection signal and obtain the current timestamp to record the current open - cover or close - cover event.

[0009] In one embodiment, an interface module is further included. The interface module is connected to the open - cover recording module and is configured to send the open - cover or close - cover event.

[0010] In one embodiment, the real - time clock module includes a second counter, a minute counter, an hour counter, a day counter, a month counter, a year counter, and a time - setting unit for setting the counting starting point of each counter.

[0011] In one embodiment, the open - cover detection module includes:

[0012] A filtering unit, configured to configure the shortest holding time of the level state of the open - cover detection pin to filter out interference.

[0013] An accumulator, connected to the open - cover detection pin, is configured to calculate the accumulated time that the level state of the open - cover detection pin remains in this state after the change.

[0014] A comparator, connected to the open - cover detection pin, is configured to compare the shortest time with the accumulated time and control the accumulator to stop counting when the shortest time is equal to the accumulated time.

[0015] An edge - judgment unit, when the shortest time is equal to the accumulated time, is configured to compare the current level state of the open - cover detection pin with the previous level state to confirm whether an open - cover or close - cover event occurs.

[0016] In one embodiment, the open - cover recording module includes two groups of time registers. The two groups of time registers are respectively configured to obtain the current timestamp from the real - time clock module when receiving the detection signals of the open - cover and close - cover events, so as to record the real - time of the current open - cover or close - cover event.

[0017] In one embodiment, each group of the time registers includes a second register, a minute register, an hour register, a day register, a month register, and a year register.

[0018] The second aspect of the embodiments of the present invention provides an MCU - based open - cover detection method, including:

[0019] Detecting the change of the level state of the open - cover detection pin and determining whether an open - cover or close - cover event occurs according to a preset rule, and outputting a detection signal indicating the open - cover or close - cover event when an open - cover or close - cover event occurs.

[0020] Receive the detection signal and obtain the timestamp when the level state of the open cover detection pin changes, so as to record the current open cover or close cover event in real time;

[0021] Send the open cover or close cover event;

[0022] Wherein, the real-time time is provided by a real-time clock module built in the MCU.

[0023] In one embodiment, the step of detecting the change of the level state of the open cover detection pin and determining whether there is an open cover or close cover event includes:

[0024] Calculate the accumulated time that the level state of the open cover detection pin remains in this state after the change;

[0025] Compare the accumulated time with a preset shortest time;

[0026] When the shortest time is equal to the accumulated time, control the accumulator to stop counting, and compare the current level state of the open cover detection pin with the previous level state to confirm whether an open cover or close cover event occurs.

[0027] In one embodiment, the preset shortest time is the shortest time that the level state of the open cover detection pin is maintained in a state and is pre-configured.

[0028] The third aspect of the embodiments of the present invention provides an electric energy meter control chip, including the above-mentioned open cover detection circuit integrated in the MCU; or, used to implement the steps of the above-mentioned open cover detection method when executing a computer program.

[0029] The above-mentioned open cover detection circuit integrated in the MCU and the open cover detection method based on the MCU work independently powered by the electric energy storage device of the electric meter. The real-time clock module and other modules can operate with low power consumption. Its power is low, ensuring that when the alternating current is cut off and only the electric energy storage device supplies power, the open cover detection of the electric meter can still be performed through the open cover detection circuit of the MCU; in addition, the above-mentioned method and circuit determine whether there is an open cover or close cover event by detecting the change of the level state of the switch detection pin and according to a preset rule. Setting the preset rule can avoid the mis-triggering of the interference signal on the switch detection pin and record the wrong open cover or close cover event, improving the accuracy of the open cover detection. Description of the Drawings

[0030] To more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.

[0031] Figure 1 It is a schematic structural diagram of an open - cover detection circuit integrated in an MCU provided by an embodiment of the present invention;

[0032] Figure 2 For Figure 1 The example circuit schematic diagram of the real - time clock module in the open - cover detection circuit shown;

[0033] Figure 3 For Figure 1 The example circuit schematic diagram of the open - cover detection module in the open - cover detection circuit shown;

[0034] Figure 4 For Figure 1 The example circuit schematic diagram of the open - cover record module in the open - cover detection circuit shown

[0035] Figure 5 It is a specific flowchart of an open - cover detection method based on an MCU provided by an embodiment of the present invention. Detailed implementation manners

[0036] In order to make the purpose, technical solutions and advantages of the present invention clearer, the following further details the present invention in combination with the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0037] There is a battery in the electricity meter for power supply, mainly for powering the real - time clock to ensure that the real - time clock can still work when the alternating current is cut off, and at the same time for powering some necessary circuits. Since the battery power is limited, the circuits powered by the battery must work in a low - power state.

[0038] MCU (Microcontroller Unit; micro - control unit), also known as a single - chip microcomputer (Single Chip Microcomputer), is to appropriately reduce the frequency and specifications of the central processing unit (Central Process Unit; CPU), and integrate peripherals such as memory, counter, USB, A / D conversion, UART, PLC, DMA, and even the LCD drive circuit on a single chip to form a chip - level computer. Compared with the CPU, the MCU has lower power consumption.

[0039] Please refer to Figure 1 , the open-cover detection circuit integrated in the MCU provided by the embodiment of the present application is powered by the available electrical energy storage device integrated in the MCU, and includes a real-time clock module 110, an open-cover detection module 120, and an open-cover record module 130.

[0040] Among them, the real-time clock module 110 is used to provide the real-time time; the open-cover detection module 120 is connected to the open-cover detection pin of the MCU, and is used to detect the change of the level state of the open-cover detection pin and determine whether an open-cover or close-cover event occurs according to a preset rule, and is used to output a detection signal indicating the open-cover or close-cover event; the open-cover record module 130 is connected to the open-cover detection module 120 and the real-time clock module 110, and is used to receive the detection signal and obtain the current timestamp to record the current open-cover or close-cover event.

[0041] Generally, there is a battery in the electric energy meter, which is mainly used to supply power to the real-time clock module 110 of the MCU to ensure that the real-time clock module 110 can still work when the alternating current is powered off, and is also used to supply power to some necessary circuits. Since the battery power is limited, the circuits powered by the battery are required to work in a low-power state. The MCU chip of the present application makes reasonable use of the battery in the electric energy meter, so that when only powered by the battery, the open-cover detection of the electric energy meter is performed through the low-power circuit inside the MCU chip. The circuit of the electric energy meter adopts a multi-power domain design, in which most of the modules other than the internal CPU and the MCU are powered by alternating current, and the internal real-time clock module 110, open-cover detection module 120, and open-cover record module 130 of the MCU are powered by the battery and work in a low-power mode.

[0042] The preset rule refers to the shortest time maintained after the change of the level state of the open-cover detection pin is configured, so as to ensure the accuracy of judging the occurrence of the open-cover or close-cover event and filter out the interference of other signal sources to the open-cover detection pin. In one embodiment, in the specific circuit design, configuring the shortest time can be embodied as configuring the RC circuit connected to the open-cover detection pin, setting the size of the filter capacitor, and configuring the charging time of the filter capacitor mapped to the shortest time.

[0043] The MCU has a built-in hardware open-cover detection circuit, and the detection of the open-cover event does not require the participation of the CPU, but is automatically detected and recorded by the open-cover detection circuit. At the same time, a general-purpose interface module 140 is integrated inside the MCU, which is mainly used to communicate with an external memory, and send the open-cover or close-cover event to the external memory, such as EEPROM, so that the data is not lost when the power is off.

[0044] Please refer to Figure 2, in one embodiment, the real-time clock module 110 includes a second counter, a minute counter, an hour counter, a day counter, a month counter, a year counter, and a time setting unit 112 for setting the counting starting point of each counter.

[0045] After the real-time clock module 110 is powered on, the module is in a working state all the time, providing accurate real-time. Before the real-time clock module 110 works, the CPU configures the time setting unit 112 through the peripheral bus interface apb_bus to write the current real-time clock to these counters and set a counting starting point. At the same time of setting the time, the second counter will be cleared. Next, the second counter starts to accumulate from 0 by 1 per second. When the count value reaches 59, a minute pulse is generated, indicating that 1 minute has been counted full, triggering the value of the minute counter to increase by 1, and at the same time clearing the second counter to 0 and restarting the counting; similarly, when the minute counter reaches 59, it is also cleared and restarted, and outputs an hour pulse to drive the hour counter to increase by 1; the hour counter accumulates from 0 to 23; the month counter accumulates from 1 to 12; the values of these counters represent the real-time clock and are output to the outside of the real-time clock module 110.

[0046] Please refer to Figure 3 , in one embodiment, the lid opening detection module 120 includes a filtering unit 121, an accumulator 122, a comparator 124, and an edge judgment unit 125.

[0047] The filtering unit 121 is used to configure the shortest time for the level state of the lid opening detection pin key to be maintained to filter out interference; the accumulator 122 is connected to the lid opening detection pin key and is used to calculate the accumulated time for the level state of the lid opening detection pin key to be maintained after the change; the comparator 124 is connected to the lid opening detection pin key and is used to compare the shortest time with the accumulated time, and controls the accumulator 122 to stop counting when the shortest time is equal to the accumulated time; the edge judgment unit 125 is used to compare the current level state of the lid opening detection pin key with the previous level state when the shortest time is equal to the accumulated time to confirm whether a lid opening or closing event occurs.

[0048] Among them, Figure 3 the apb_bus pin refers to the Advanced Peripheral Bus. The CPU configures the internal registers of the lid opening detection module 120 or reads the internal circuit values of the hardware module through this bus interface, which can be understood as the channel for the CPU to configure the hardware circuit by executing programs. In this embodiment, the function of the bus of the apb_bus pin is to configure the shortest time for the level state of the filtering unit 121 of the pin to be maintained, that is, the filtering time.

[0049] The open cover detection module 120 continuously detects the change in the level status of the open cover detection pin key in contact with the meter cover to detect whether an open cover or close cover event occurs. Specifically, first, the CPU needs to configure the predefined filtering time (the shortest time for the level status to be maintained) value into the filtering unit 121. This value is configured according to the actual interference source and is mainly used to prevent false triggering of the open cover. For example, under the action of the interference source, the status of the open cover detection pin key will frequently flip. Suppose the flip frequency is greater than 1 KHz, that is, the stable time of the status of the open cover detection pin key is less than 1 ms. Then, the shortest time of the filtering unit 121 can be configured to be greater than 1 ms to filter out this interference source. The accumulator 122 is mainly used to calculate the time when the level of the open cover detection pin key is stable. Suppose that when the meter cover is closed, the level on the open cover detection pin key is high. When the status of the open cover detection pin key remains unchanged, after the accumulator 122 calculates the filtering time value of the filtering unit 121, it stops counting, indicating that the current status is stable. In addition, there is also a clearing control unit 123 connected to the open cover detection pin key. When the clearing control unit 123 detects a change in the level on the open cover detection pin key, it controls the accumulator 122 to clear and start counting again; the comparator 124 continuously compares the accumulated time value of the accumulator 122 with the shortest time value configured by the filtering unit 121. When the two values are equal, the counting of the accumulator 122 stops. At this time, the edge judgment unit 125 compares the current status of the open cover detection pin key with the previous status of the open cover detection pin key in the register 126. If the status is opposite, it indicates that an open cover or close cover event has occurred; if the status remains unchanged, it is determined that no open cover or close cover event has occurred. After an open cover or close cover event occurs, the open cover detection module 120 sends a signal to the open cover record module 130 and the general interface module 140, indicating that an open cover or close cover event has occurred. Specifically, a detection signal indicating the open cover event is sent through the key_pos pin, and a detection signal indicating the close cover event is sent through the key_neg pin. Among them, for the key_pos pin: its output is the rising edge pulse signal of the open cover detection pin key. When the open cover detection pin key changes from the low level status to the high level status, a pulse will be generated. For the key_neg pin: its output is the falling edge pulse signal of the open cover detection pin key. When the open cover detection pin key changes from the high level status to the low level status, a pulse will be generated.

[0050] Please refer to Figure 4, in one embodiment, the opening record module 130 includes two sets of time registers. The two sets of time registers are respectively used to obtain the current timestamp from the real-time clock module 110 when receiving the detection signals of the opening and closing events, so as to record the real-time of the current opening or closing event. In one embodiment, each set of time registers includes a second register, a minute register, an hour register, a day register, a month register and a year register. In addition, the second register, the minute register, the hour register, the day register, the month register and the year register are respectively connected to the second counter, the minute counter, the hour counter, the day counter, the month counter and the year counter of the real-time clock module 110.

[0051] When the opening record module 130 receives the detection signal indicating the opening or closing event, the opening record module 130 obtains the current timestamp from the real-time clock module 110, and according to the configuration, decides whether to record the current real-time to the register and records that an opening or closing event has occurred. Whether to record the current opening or closing event can be flexibly configured. The configuration recording rules can include only recording the times of the first few openings or, for each opening, recording the latest opening time to overwrite the old opening time. When the time needs to be recorded, the timestamp is saved to the internal register, and then wait for the next opening or closing event to occur. Similarly, when a closing event occurs, the current time is also recorded to the year, month, day, hour, minute and second registers. The CPU can read these registers through the interface reg_out of the system bus to obtain the opening and closing times.

[0052] The interface module 140 mainly generates the timing for writing to the external memory according to the interface protocol of the external memory. This communication protocol usually has the concept of frame data. Before sending the data, the currently to-be-sent data is combined into a complete data frame, and the frame header, frame tail, check bit, handshake signal, etc. are added to ensure the correctness of data transmission. When receiving the detection signal indicating the opening or closing event, obtain the current timestamp from the real-time clock module 110 and send it to the general external interface according to the agreed protocol. At this time, when the controller of the external memory correctly receives a frame of data and passes the verification, the current timestamp is saved to the memory, and a successful handshake signal is sent to the general external module to indicate successful communication; otherwise, a failure handshake signal is sent to the general peripheral interface module 140 to indicate communication failure and wait for retransmission of the data.

[0053] Please refer to Figure 5 , the second aspect of the embodiments of the present invention provides a method for detecting the opening of a cover based on an MCU, including:

[0054] Step S120: Detect the change in the level status of the lid-opening detection pin, determine whether there is a lid-opening or lid-closing event according to a preset rule, and output a detection signal indicating the lid-opening or lid-closing event when there is a lid-opening or lid-closing event.

[0055] Assume that when the watch cover is closed, the level on the lid-opening detection pin of the MCU is high, and at this time, the status change of the lid-opening detection pin is detected in real time. When it is detected that the level of the lid-opening detection pin is low, the pin status is filtered according to the preset rule configured in advance. If the time when the lid-opening detection pin becomes low is less than the configured time, for example, the configured filtering time is 20 ms, and if the time when the lid-opening detection pin becomes low is 10 ms, it is determined that there is no lid-opening behavior, while if the time when the lid-opening detection pin becomes low is 40 ms, it is determined that a lid-opening behavior has occurred.

[0056] Step S120: Receive the detection signal, and obtain the timestamp when the level status of the lid-opening detection pin changes, so as to record the current lid-opening or lid-closing event in real time.

[0057] Step S130: Send the lid-opening or lid-closing event;

[0058] Wherein, the real-time time is provided by a real-time clock module built in the MCU.

[0059] In addition, it is also configured whether to record the lid-opening or lid-closing time. If it is configured, the time of the real-time clock of the current lid-opening or lid-closing event is recorded in the internal register; and the startup interface module is used to save the current timestamp to the external memory according to the pre-agreed timing and data frame structure.

[0060] When the lid-opening time occurs, the current timestamp is obtained from the real-time clock module, and data is framed according to the timing pre-agreed with the memory. Then it is sent to the memory through the general-purpose peripheral interface. When the memory correctly receives the data and the data verification passes, a handshake signal will be returned, indicating successful communication, and the data will be recorded in the memory. At this time, a lid-opening event record is successful. When the general-purpose peripheral interface module does not receive the handshake signal returned by the memory, or receives a handshake signal indicating failure, the data will be resent. When the number of retransmissions exceeds the set number, it is determined that the communication fails, and the lid-opening time of this time is not recorded.

[0061] Similarly, after the lid is opened, the level of the lid-opening detection pin is low. At this time, it is necessary to detect the action of closing the watch cover, that is, to detect and judge whether the pin becomes high. When it is detected that the lid-opening detection pin becomes high and meets the filtering time, it is determined that it is a lid-closing behavior, and the time of the current real-time clock is recorded in the internal register and the timestamp is saved to the external memory.

[0062] In one embodiment, the step of detecting a change in the level state of the open cover detection pin and determining whether an open cover or close cover event occurs includes:

[0063] Calculating the cumulative time that the level state of the open cover detection pin remains in this state after the change;

[0064] Comparing the cumulative time with a preset shortest time;

[0065] When the shortest time is equal to the cumulative time, controlling the accumulator to stop counting, and comparing the current level state of the open cover detection pin with the previous level state to confirm whether an open cover or close cover event occurs.

[0066] In one embodiment, the preset shortest time is the shortest time for the level state of the open cover detection pin key configured in advance to remain in one state.

[0067] The above open cover detection circuit integrated in the MCU and the open cover detection method based on the MCU operate independently powered by the electrical energy storage device of the electric meter. The real-time clock module and other modules can operate with low power consumption, and its power is low, ensuring that when the alternating current is powered off and only the electrical energy storage device supplies power, the open cover detection of the electric meter can still be performed through the open cover detection circuit of the MCU; in addition, the above method and circuit determine whether an open cover or close cover event occurs by detecting a change in the level state of the open cover detection pin and according to a preset rule. Setting the preset rule can avoid mis-triggering of the open cover detection pin by interference signals and record incorrect open cover or close cover events, improving the accuracy of open cover detection.

[0068] The third aspect of the embodiments of the present invention provides an electric energy meter control chip, including the above open cover detection circuit integrated in the MCU; or, used to implement the steps of the above open cover detection method when executing a computer program.

[0069] When the electric energy meter control chip executes the computer program, it implements the steps in the above various open cover detection method embodiments, such as Figure 5 The steps 110 to 130 shown. Or, when the electric energy meter control chip executes the computer program, it implements the functions of each module / unit in the above embodiments of each open cover detection circuit, such as Figure 1 The functions of the modules 110 to 140 shown.

[0070] Those skilled in the art can clearly understand that, for the convenience and conciseness of description, only the above-mentioned division of each functional unit and module is used as an example. In actual applications, the above functions can be assigned to different functional units and modules according to needs, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiments can be integrated into a processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above integrated units can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of each functional unit and module are only for the convenience of mutual distinction and do not limit the protection scope of this application. The specific working processes of the units and modules in the above system can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated herein.

[0071] In the above embodiments, the descriptions of the respective embodiments have their own emphases. For parts not detailed or recorded in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0072] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or by a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. A professional technician can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.

[0073] In the embodiments provided by the present invention, it should be understood that the disclosed device / terminal device and method can be implemented in other ways. For example, the device / terminal device embodiments described above are merely illustrative. For example, the division of the module or unit is only a logical function division, and there can be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection to each other can be through some interfaces, and the indirect coupling or communication connection of the device or unit can be in an electrical, mechanical or other form.

[0074] The unit described as a separated component may or may not be physically separated, and the component displayed as a unit may or may not be a physical unit, that is, it can be located in one place, or can be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0075] In addition, in each embodiment of the present invention, each functional unit can be integrated into a processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit.

[0076] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, all or part of the processes in the above-mentioned embodiment methods of the present invention can also be completed by instructing relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, the steps of the above-mentioned various method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in the form of source code, object code, executable file or some intermediate form, etc. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal, and software distribution medium, etc. It should be noted that the content included in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electrical carrier signals and telecommunication signals.

[0077] The above-mentioned embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the various embodiments of the present invention, and should all be included in the protection scope of the present invention.

Claims

1. An open - cover detection circuit integrated in an MCU, where the MCU can be powered by an electrical energy storage device, characterized in that, including: a real-time clock module for providing real-time; a lid-opening detection module connected to the lid-opening detection pin of the MCU, for detecting the change of the level state of the lid-opening detection pin and determining whether a lid-opening or lid-closing event occurs according to a preset rule, and for outputting a detection signal indicating the lid-opening or lid-closing event, where the preset rule refers to the shortest time for maintaining the change of the level state of the lid-opening detection pin; a lid-opening record module connected to the lid-opening detection module and the real-time clock module, for receiving the detection signal and obtaining the current timestamp to record the current lid-opening or lid-closing event; the lid-opening detection module includes: a filtering unit for configuring the shortest time for maintaining the level state of the lid-opening detection pin to filter out interference; an accumulator connected to the lid-opening detection pin for calculating the accumulated time for maintaining the level state after the change of the level state of the lid-opening detection pin; a comparator connected to the lid-opening detection pin for comparing the shortest time with the accumulated time, and controlling the accumulator to stop counting when the shortest time is equal to the accumulated time; an edge judgment unit for comparing the current level state of the lid-opening detection pin with the previous level state to confirm whether a lid-opening or lid-closing event occurs when the shortest time is equal to the accumulated time.

2. The open - cover detection circuit integrated in an MCU according to claim 1, characterized in that, also includes an interface module, the interface module is connected to the lid-opening record module for sending the lid-opening or lid-closing event.

3. The open - cover detection circuit integrated in an MCU according to claim 1, characterized in that, the lid-opening record module includes two groups of time registers, and the two groups of time registers are respectively used to obtain the current timestamp from the real-time clock module when receiving the detection signals of the lid-opening and lid-closing events, so as to record the real-time of the current lid-opening or lid-closing event.

4. The open - cover detection circuit integrated in an MCU according to claim 3, characterized in that, each group of the time registers includes a second register, a minute register, an hour register, a day register, a month register and a year register.

5. An open - cover detection method based on an MCU, characterized in that, including: detecting the change of the level state of the lid-opening detection pin and determining whether a lid-opening or lid-closing event occurs, and outputting a detection signal indicating the lid-opening or lid-closing event when a lid-opening or lid-closing event occurs; receiving the detection signal, and obtaining the timestamp when the level state of the lid-opening detection pin changes, so as to record the current lid-opening or lid-closing event in real time; sending the lid-opening or lid-closing event; wherein, the real-time is provided by a real-time clock module built in the MCU; the step of detecting the change of the level state of the lid-opening detection pin and determining whether a lid-opening or lid-closing event occurs includes: calculating the accumulated time for maintaining the level state after the change of the level state of the lid-opening detection pin; comparing the accumulated time with the preset shortest time; when the shortest time is equal to the accumulated time, controlling the accumulator to stop counting, and comparing the current level state of the lid-opening detection pin with the previous level state to confirm whether a lid-opening or lid-closing event occurs.

6. The open - cover detection method according to claim 5, characterized in that, the preset shortest time is the shortest time for maintaining the level state of the lid-opening detection pin in a certain state pre-configured.

7. An electric energy meter control chip, characterized in that, Including the lid-opening detection circuit integrated in the MCU according to any one of claims 1 to 4; or, for implementing the steps of the lid-opening detection method according to claim 5 or 6 when executing a computer program.

Citation Information

Patent Citations

  • Operation monitoring device and method for onsite detection equipment of electric energy meter

    CN106980102A

  • Electric energy meter capable of detecting uncapping in power cut state

    CN202119820U

  • Wherein uncovering detection circuit and electric energy meter control chip are integrated on MCU

    CN212159910U