CN115754703A - Switching operation detection circuit, switching operation detection method, computer device, and storage medium - Google Patents

Switching operation detection circuit, switching operation detection method, computer device, and storage medium Download PDF

Info

Publication number
CN115754703A
CN115754703A CN202211535658.3A CN202211535658A CN115754703A CN 115754703 A CN115754703 A CN 115754703A CN 202211535658 A CN202211535658 A CN 202211535658A CN 115754703 A CN115754703 A CN 115754703A
Authority
CN
China
Prior art keywords
module
detection circuit
switch
resistor
switching
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211535658.3A
Other languages
Chinese (zh)
Inventor
疏银胜
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Lexy Electric Green Energy Technology Suzhou Co Ltd
Suzhou Kingclean Precision Machinery Co Ltd
Original Assignee
Lexy Electric Green Energy Technology Suzhou Co Ltd
Suzhou Kingclean Precision Machinery Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Lexy Electric Green Energy Technology Suzhou Co Ltd, Suzhou Kingclean Precision Machinery Co Ltd filed Critical Lexy Electric Green Energy Technology Suzhou Co Ltd
Priority to CN202211535658.3A priority Critical patent/CN115754703A/en
Publication of CN115754703A publication Critical patent/CN115754703A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Power Sources (AREA)

Abstract

The invention relates to the technical field of circuit detection, and particularly discloses a switching action detection circuit, a method, computer equipment and a storage medium, wherein the anode of a power supply module is connected with a first movable end of a switching module, the cathode of the power supply module is connected with the cathode of a control module, and the anode of the control module is connected with a common end of the switching module; the control module comprises a switch detection circuit, a voltage detection circuit and a main control unit, the switch detection circuit is respectively connected with the second movable end of the switch module and the main control unit, and the voltage detection circuit is respectively connected with the public end and the main control unit; the voltage detection circuit is used for detecting a first electric signal at the common end; the switch detection circuit is used for detecting a second electric signal at the second moving end; the main control unit is used for determining the switching action of the switching module according to the first electric signal and/or the second electric signal. The action of the switch module is detected by the switch action detection circuit, so that the running stability of the control module is ensured, and the safety of the control module is improved.

Description

Switching operation detection circuit, switching operation detection method, computer device, and storage medium
Technical Field
The present invention relates to the field of circuit detection technologies, and in particular, to a circuit and a method for detecting a switching operation, a computer device, and a storage medium.
Background
When a strong current switch is used for controlling the power on and power off of a high-power controller, several seconds are needed for power failure from the power off switch to an MCU (micro controller Unit) on the controller, and data detected by the MCU are all in an unstable state in the process. Therefore, in a strong electric circuit, frequent switching on and off can make the controller in an unstable state, thereby affecting the effectiveness of the controller in collecting data.
Disclosure of Invention
In view of the above, it is necessary to provide a switching operation detection circuit, a switching operation detection method, a computer device, and a storage medium for solving the problem that frequent switching operations in a heavy-current circuit may cause a controller to be in an unstable state, thereby affecting validity of data collected by the controller.
A switch action detection circuit comprises a switch module, a power supply module and a control module, wherein the switch module comprises a public end, a first movable end and a second movable end, the positive pole of the power supply module is connected with the first movable end, the negative pole of the power supply module is connected with the negative pole of the control module, and the positive pole of the control module is connected with the public end; the control module comprises a switch detection circuit, a voltage detection circuit and a main control unit, the switch detection circuit is respectively connected with the second movable end and the main control unit, and the voltage detection circuit is respectively connected with the public end and the main control unit; the voltage detection circuit is used for detecting a first electric signal at the common end; the switch detection circuit is used for detecting a second electric signal at the second movable end; the main control unit is used for determining the switching action of the switching module according to the first electric signal and/or the second electric signal.
In one embodiment, the switch detection circuit includes a first resistor, a second resistor, a third resistor, a fourth resistor, a fifth resistor, a zener diode, a first capacitor, and a first field effect transistor, a first end of the first resistor is connected to the second moving end, a second end of the first resistor is connected to a drain of the first field effect transistor, a gate of the first field effect transistor is connected to a first end of the fourth resistor, a first end of the fifth resistor, and an anode of the zener diode, respectively, a source of the first field effect transistor is connected to a first end of the second resistor and a first end of the third resistor, respectively, a second end of the fifth resistor is connected to a power supply, a second end of the second resistor is connected to a first end of the first capacitor and the main control unit, and a second end of the first capacitor, a second end of the third resistor, a second end of the fourth resistor, and a cathode of the zener diode are all grounded.
In one embodiment, the power module is a dc power source outputting a predetermined electrical signal.
A switching operation detection method applied to the switching operation detection circuit according to any one of the above embodiments, where the switching operation detection circuit includes a switch module, the switch module includes a common terminal and a second moving terminal, and the method includes obtaining a first electrical signal at the common terminal and a second electrical signal at the second moving terminal; determining a switching action of the switching module from the first electrical signal and/or the second electrical signal.
In one embodiment, the determining the switching action of the switch module according to the first electrical signal and/or the second electrical signal includes determining that the switch module is in a closed state when the first electrical signal is greater than a first threshold and the second electrical signal is less than or equal to a second threshold.
In one embodiment, after determining that the switch module is in the closed state, the method further includes detecting states of all pins and setting a detection determination time of the relevant variable.
In one embodiment, the determining the switching action of the switching module according to the first electrical signal and/or the second electrical signal further includes determining that the switching module is in an off state when the second electrical signal is greater than a second threshold.
In one embodiment, after the switch module is determined to be in the off state, the method further includes clearing all the detected relevant variables.
In one embodiment, before acquiring the first electrical signal at the common end and the second electrical signal at the second movable end, the method further comprises setting the detection judgment time of the relevant variable to be greater than a preset threshold value.
A computer device comprising a memory storing a computer program and a processor implementing the steps of the switching action detection method according to any one of the above embodiments when the processor executes the computer program.
A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the switching action detection method according to any one of the above-mentioned embodiments.
A computer program product comprising a computer program which, when executed by a processor, carries out the steps of the switching action detection method of any of the above embodiments.
In the switching action detection circuit, the switching module can be used for switching on or switching off the connection path between the power supply module and the control module, so that the switching on or switching off of the control module is changed. The control module respectively detects a first electric signal at a common end of the switch module and a second electric signal at a second movable end by using the voltage detection circuit and the switch detection circuit, so that the main control unit can determine the switching action of the switch module according to the first electric signal and/or the second electric signal. The switch action detection circuit is used for detecting the action of the switch module in real time, so that the running stability of the control module is ensured, and the safety of the control module is improved.
Drawings
In order to more clearly illustrate the embodiments of the present specification or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments described in the specification, and other drawings can be obtained by those skilled in the art without inventive labor.
FIG. 1 is a schematic diagram of a switching operation detection circuit according to an embodiment of the present disclosure;
FIG. 2 is a schematic diagram of a switch detection circuit according to an embodiment of the present disclosure;
FIG. 3 is a schematic flow chart of a method for detecting a switch according to one embodiment of the present disclosure;
FIG. 4 is a schematic flow chart of a method for detecting a switch according to another embodiment of the present disclosure;
FIG. 5 is a schematic structural diagram of an apparatus for implementing a switching operation detection method according to an embodiment of the present disclosure;
FIG. 6 is a diagram of the internal structure of a computer device in one embodiment of the present disclosure.
Detailed Description
To facilitate an understanding of the invention, the invention will now be described more fully hereinafter with reference to the accompanying drawings. Preferred embodiments of the present invention are shown in the drawings. This invention may, however, be embodied in many different forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. The terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used herein, the term "and/or" includes any and all combinations of one or more of the associated listed items.
When a high-power controller is controlled by a strong-current switch to realize power-on and power-off, the time from the power-off switch to the MCU on the controller to completely power off usually needs several seconds, and data detected by the MCU are all in an unstable state in the process. If the switch is closed before the MCU is not completely powered down, the MCU will continue to operate, and unreasonable protection phenomena may be triggered due to sudden increase of current or voltage in the circuit, so that the problems of shaking or strong noise and the like of the electric tool occur, and the use experience of a user is influenced. The switch action detection circuit provided by the disclosure can detect the action of the strong current switch in real time, so that the controller can further judge according to the switch action.
Fig. 1 is a schematic structural diagram of a switching operation detection circuit according to one embodiment of the disclosure, in which the switching operation detection circuit may include a switch module 100, a power module 200, and a control module 300.
The switch module 100 may be a single-pole double-throw switch, i.e., the switch may be flipped to both sides to perform a double control function. The switch module 100 may include a first moving terminal 1, a common terminal 2, and a second moving terminal 3. The positive pole of the power module 200 is connected to the first moving terminal 1, the negative pole of the power module 200 is connected to the negative pole of the control module 300, and the positive pole of the control module 300 is connected to the common terminal 2. That is, the power module 200 may be connected to the control module 300 through the switch module 100, and the switch module 100 may change on or off between the switch module 100 and the control module 300 by changing on/off between the first movable terminal 1 and the common terminal 2.
The control module 300 may include a switch detection circuit 310, a voltage detection circuit 320, and a main control unit 330. The switch detection circuit 310 may be connected to the second moving terminal 3 and the main control unit 330, respectively, and the voltage detection circuit 320 may be connected to the common terminal 2 and the main control unit 330, respectively. The main control unit 330 may be an MCU. The voltage detection circuit 320 may be used to detect a first electrical signal at the common terminal 2 and the switch detection circuit 310 may be used to detect a second electrical signal at the second movable terminal. The main control unit 330 may determine the switching action of the switch module 100 according to the first electrical signal detected by the voltage detection circuit 320 and/or the second electrical signal detected by the switch detection circuit 310.
In this embodiment, the first moving terminal 1 can be a normally open terminal, and the second moving terminal 3 can be a normally closed terminal, that is, the switch module 100 is usually in a state where the second moving terminal 3 is conducted with the common terminal 2. Therefore, in the present embodiment, it is defined that the switch module 100 is in the closed state when the first moving terminal 1 is conducted with the common terminal 2, and the switch module 100 is in the open state when the second moving terminal 3 is conducted with the common terminal 2.
When the switch is turned to the first moving terminal 1, the first moving terminal 1 is connected to the common terminal 2, so that the power module 200 can provide power to the control module 300, and the control module 300 is powered on. At this time, the voltage detection circuit 320 may detect that the voltage at the common terminal 2 is large, i.e., the first electrical signal is at a high level. Meanwhile, since the switch is toggled to the first moving terminal 1, the second moving terminal 3 is in an open circuit, and the switch detection circuit 310 will detect that the voltage at the second moving terminal is 0, i.e. the second electrical signal is at a low level. The main control unit 330 may determine that the power module 200 is conducted with the control module 300, that is, the switch module 100 is in a closed state, by combining the information that the first electrical signal is at a high level and the second electrical signal is at a low level.
When the switch is switched from the first moving terminal 1 to the second moving terminal 3, the second moving terminal 1 is connected to the common terminal 2, so that the connection between the power module 200 and the control module 300 is disconnected, and the control module 300 is powered off. However, since it takes several seconds to turn off the switch until the main control module 310 in the control module 300 is completely powered down, the residual power in the control module 300 is transmitted to the second moving terminal 3, so that the switch detection circuit 310 can detect that the voltage at the second moving terminal 3 is large, i.e. the second electrical signal is at a high level. Therefore, the main control unit 330 may determine that the second movable terminal 3 is connected to the common terminal 2, that is, the switch module 100 is in the off state, according to the information that the second electrical signal is at the high level.
If the switch is closed immediately after being opened, that is, the switch is immediately pulled back to the first moving end 1 after being pulled from the first moving end 1 to the second moving end 3, the control module 300 may also determine all actions of the switch according to the change of the first electrical signal and/or the second electrical signal. Therefore, the switch action detection circuit can ensure that the control module 300 can identify all relevant actions of the switch module 100 when the complete machine frequently opens and closes the switch module 100, so as to judge the validity of the currently acquired data according to the switch action.
In the switching action detection circuit, the switching module 100 may be used to turn on or off a connection path between the power module 200 and the control module 300, so as to change the on/off state of the control module 300. The control module 300 detects a first electrical signal at the common terminal and a second electrical signal at the second active terminal of the switch module 100 by using the voltage detection circuit 320 and the switch detection circuit 310, respectively, so that the main control unit 330 can determine the switching action of the switch module 100 according to the first electrical signal and/or the second electrical signal. The switch action detection circuit is used for detecting the action of the switch module in real time, so that the running stability of the control module 300 can be ensured, and the safety of the control module 300 can be improved. The switch action detection circuit has the advantages that the overall performance is improved through less design cost, and the market competitiveness of the product is effectively improved.
Fig. 2 is a schematic structural diagram of a switch detection circuit in one embodiment of the present disclosure, and in one embodiment, the switch detection circuit 310 may include a first resistor R1, a second resistor R2, a third resistor R3, a fourth resistor R4, a fifth resistor R5, a zener diode D1, a first capacitor C1, and a first field effect transistor Q1. According to the practical application requirements of the switching action detection circuit in different application scenes, appropriate device parameters can be selected for the first resistor R1, the second resistor R2, the third resistor R3, the fourth resistor R4, the fifth resistor R5, the voltage stabilizing diode D1, the first capacitor C1 and the first field effect transistor Q1.
In the present embodiment, the first field effect transistor Q1 is an N-channel enhancement MOSFET. The embodiment can meet the circuit requirement of low power consumption under various wiring modes by using the N-channel enhancement type MOSFET as isolation. For example, when the common terminal 2 is connected to the positive electrode of the power supply, the second moving terminal 3 is connected to the switch detection circuit 310, and the first moving terminal 1 is connected to the controller, the first fet Q1 can still meet the low power consumption requirement of the circuit.
Referring to fig. 2, a first end of the first resistor R1 is connected to the second moving end SWITCH _ NC, a second end of the first resistor R1 is connected to a drain of the first field-effect transistor Q1, a gate of the first field-effect transistor Q1 is respectively connected to a first end of the fourth resistor R4, a first end of the fifth resistor R5, and an anode of the zener diode D1, and a source of the first field-effect transistor Q1 is respectively connected to a first end of the second resistor R2 and a first end of the third resistor R3.
The third resistor R3 and the fourth resistor R4 may serve as a pull-down resistor of the first field effect transistor Q1. When the power is off, if the first field effect transistor Q1 is in the on state, the parasitic capacitance between the gate and the source has no discharge path, which easily causes the breakdown of the first field effect transistor Q1. The third resistor R3 and the fourth resistor R4 can provide a discharge path to prevent the MOS tube from generating misoperation, thereby playing a role in protecting the first field effect tube Q1.
The zener diode D1 can also be used to keep the voltage between the gate and the source stable, and when the voltage VGS between the gate and the source fluctuates, the zener diode D1 can be used to limit the gate voltage of the first field effect transistor Q1 below the regulated value, so as to protect the first field effect transistor Q1 from being broken down by high current.
A second end of the fifth resistor R5 is connected to the power supply VCC, and the fifth resistor R5 may be used as a pull-up resistor of the gate of the first fet Q1. When the power is on, the pull-up resistor can give a certain level to the gate of the first field-effect tube Q1, so that the gate level of the first field-effect tube Q1 is prevented from being uncertain and interfered when the General-purpose input/output (GPIO) is in a high-resistance state when the power is on. A second end of the second resistor R2 is connected to the first end of the first capacitor C1 and the main control unit 330, respectively. When the main control unit 330 is an MCU, the second end of the second resistor R2 and the first end of the first capacitor C1 may be connected to the MCU _ AD pin. The second end of the first capacitor C1, the second end of the third resistor R3, the second end of the fourth resistor R4 and the cathode of the zener diode D1 are all grounded.
When the SWITCH module 100 is closed, the SWITCH is turned to the first moving terminal 1, the first moving terminal 1 is connected to the common terminal 2, and since the second moving terminal 3 is in the off state at this time, the voltage at the SWITCH _ NC is 0V, the gate-source voltage VGS =0 at this time, and the first field effect transistor Q1 is in the off state, so that the voltage at the MCU _ AD is also 0V. It can be seen that the second electrical signal detected by the switch detection circuit 310 at the second moving end 3 is low. Meanwhile, since the first active terminal 1 is connected to the common terminal 2 and is turned on, and the control module 300 is powered on, the voltage detected by the voltage detection circuit 320 connected to the common terminal 2 is at a high level, that is, the first electrical signal is at a high level. The main control unit 330 can determine that the switch module 100 is in the closed state at this time by combining the first electrical signal detected by the voltage detection circuit 320 and the second electrical signal detected by the switch detection circuit 310.
At the moment when the switch module 100 is switched from the on state to the off state, that is, when the switch is switched from the first moving terminal 1 to the second moving terminal 3, and the second moving terminal 3 is connected to the common terminal 2, because the residual electric quantity exists in the control module 300, the electricity emitted by the control module 300 is transmitted to the second moving terminal 3 through the common terminal 2. That is, the voltage at SWITCH _ NC is the same as the voltage at the positive pole of the control module 300. At this time, the gate-source voltage VGS is greater than 0, and when VGS is greater than the turn-on voltage, the first field effect transistor Q1 is turned on, so that the voltage at the MCU _ AD is a high level signal. That is, when the switch is turned off, the second electric signal detected by the switch detection circuit 310 at the second moving terminal 3 is at a high level. The main control unit 330 can determine that the switch is in the off state at this time according to the high level signal at the MCU _ AD at this time.
Even if the switch is closed immediately after being turned off, that is, the voltage at the mcu \ ad position immediately after the switch is shifted from the first moving terminal 1 to the second moving terminal 3 changes from a high level signal to a low level signal, the main control unit 330 can determine that the switch module 100 is frequently turned on or off according to the change of the first electrical signal and/or the second electrical signal. Further, the control module 300 may execute different commands according to the detected switching actions to ensure the stability and safety of the control module 300.
In one embodiment, the power module 200 is a dc power source outputting a predetermined electrical signal. In this embodiment, the preset electrical signal may be an electrical signal with high power, high current, and low frequency, that is, the power module 200 is a direct current strong power supply. The switching operation detection circuit is suitable for a direct current strong current circuit.
Based on the above description of the embodiment of the switching action detection circuit, the invention also provides a switching action detection method. The switching operation detection circuit may include a device (including a distributed system), software (application), a module, a component, a server, a client, and the like, which uses the switching operation detection method according to the embodiment of the present specification, and a device that incorporates necessary hardware for implementation. Based on the same innovative concept, embodiments of the present invention provide methods in one or more embodiments as described in the following embodiments. Since the implementation scheme of the method for solving the problem is similar to that of the apparatus, the specific apparatus implementation in the embodiment of the present description may refer to the implementation of the foregoing apparatus, and repeated details are not repeated. As used hereinafter, the term "unit" or "module" may be a combination of software and/or hardware that implements a predetermined function. The means described in the above embodiments may be implemented in software or hardware, or a combination of software and hardware.
Fig. 3 is a schematic flow chart of a method for detecting a switch according to one embodiment of the present disclosure, in which the method for detecting a switch can be applied to a circuit for detecting a switching operation according to any one of the above embodiments, and the method includes the following steps S100 to S200.
Step S100: a first electrical signal at a common terminal and a second electrical signal at a second moving terminal are acquired.
The switching action detection circuit may include a switching module 100, a power module 200, and a control module 300. The control module 300 may include a switch detection circuit 310, a voltage detection circuit 320, and a main control unit 330. The voltage detection circuit 320 may be used to detect a first electrical signal at the common terminal 2 and the switch detection circuit 310 may be used to detect a second electrical signal at the second movable terminal. The voltage detection circuit 320 and the switch detection circuit 310 may transmit the detected first electrical signal and the second electrical signal to the main control unit 330, respectively, in real time.
Step S200: the switching action of the switching module is determined from the first electrical signal and/or the second electrical signal.
The switch module 100 may include a first moving terminal 1, a common terminal 2, and a second moving terminal 3. In this embodiment, the first moving terminal 1 may be a normally open terminal, and the second moving terminal 3 may be a normally closed terminal, that is, the switch module 100 is normally in a state where the second moving terminal 3 is conducted with the common terminal 2. Therefore, in the present embodiment, it is defined that the switch module 100 is in the closed state when the first moving terminal 1 is conducted with the common terminal 2, and the switch module 100 is in the open state when the second moving terminal 3 is conducted with the common terminal 2.
When the switch module 100 is closed, the power module 200 may provide power to the control module 300 and the control module 300 is powered on. At this time, the voltage detection circuit 320 may detect that the first electrical signal at the common terminal 2 is at a high level. Meanwhile, since the switch is toggled to the first moving terminal 1, the second moving terminal 3 is in an open circuit, and the switch detection circuit 310 will detect that the second electrical signal at the second moving terminal 3 is at a low level. The main control unit 330 may determine that the power module 200 is conducted with the control module 300, that is, the switch module 100 is in the closed state, according to the information that the first electrical signal is at the high level and the second electrical signal is at the low level.
When the switch module 100 is turned off, the connection path between the power module 200 and the control module 300 is disconnected, and the control module 300 is powered off. However, since it takes several seconds to completely power down the main control module 330 in the control module 300 by opening the switch, the residual power in the control module 300 will be transmitted to the second moving terminal 3, so that the switch detection circuit 310 can detect that the second electric signal at the second moving terminal 3 is at a high level. Therefore, the main control unit 330 may determine that the second movable terminal 3 is connected to the common terminal 2, that is, the switch module 100 is in the off state, according to the information that the second electrical signal is at the high level.
If the switch module 100 is closed immediately after being opened, the control module 300 may also determine all actions of the switch according to the changes of the first electrical signal and/or the second electrical signal. Therefore, the switch action detection circuit can ensure that the control module 300 can identify all relevant actions of the switch module 100 when the complete machine frequently opens and closes the switch module 100, so as to judge the validity of the currently acquired data according to the switch action.
In the above switching operation detection method, by detecting the first electrical signal at the common terminal of the switch module 100 and the second electrical signal at the second active terminal, the switching operation of the switch module 100 can be determined according to the first electrical signal and/or the second electrical signal. By monitoring the operation of the switch module 100 in real time, the operation stability of the control module 300 can be ensured, and the safety of the control module 300 can be improved. Therefore, the switching action detection method can improve the performance of the whole machine and improve the market competitiveness of the product.
Fig. 4 is a flowchart illustrating a method of a switch detection method according to another embodiment of the disclosure, wherein in one embodiment, determining a switching action of a switch module according to a first electrical signal and/or a second electrical signal may include the following step S210.
Step S210: and when the first electric signal is greater than the first threshold value and the second electric signal is less than or equal to the second threshold value, judging that the switch module is in a closed state.
The second threshold may be a start voltage of the first field effect transistor Q1, and when the second electrical signal at the second moving end 3 is less than or equal to the start voltage of the first field effect transistor Q1, the first field effect transistor Q1 is turned off, so that the voltage at the MCU _ AD is a low level signal. That is, when the switch is closed, the second electric signal detected by the switch detection circuit 310 at the second moving end 3 is a low-level signal equal to or less than the second threshold value. The first threshold may be a value for determining whether the common node 2 is conducted with the power module 200. That is, when the switch is closed, the first electric signal detected at the common terminal 2 by the voltage detection circuit 320 is a high-level signal greater than the first threshold value. The main control unit 330 can determine that the switch module 100 is in the closed state at this time by combining the first electrical signal detected by the voltage detection circuit 320 and the second electrical signal detected by the switch detection circuit 310.
In one embodiment, after determining that the switch module is in the closed state, the method may further include the following step S211.
Step S211: and detecting the states of all the pins and setting the detection judgment time of the related variables.
When the main control unit 330 determines that the switch module 100 is in the closed state at this time by combining the first electrical signal detected by the voltage detection circuit 320 and the second electrical signal detected by the switch detection circuit 310, the MCU may perform operations of re-detecting states of all pins and setting detection determination time of relevant variables, so as to ensure validity of data acquired by the MCU.
In one embodiment, determining the switching action of the switching module according to the first electrical signal and/or the second electrical signal may further include the following step S220.
S220: and when the second electric signal is larger than the second threshold value, the switch module is judged to be in an off state.
When the switch module 100 is turned off, the switch is shifted from the first moving terminal 1 to the second moving terminal 3, and the second moving terminal 3 is connected to the common terminal 2. Since there is a residual amount of power in the control module 300, the power discharged from the control module 300 is transmitted to the second movable terminal 3 through the common terminal 2. That is, the voltage at SWITCH _ NC is the same as the voltage at the positive pole of the control module 300. The second threshold may be a start-up voltage of the first field-effect transistor Q1, and when VGS is greater than the start-up voltage, the first field-effect transistor Q1 is turned on, so that the voltage at the MCU _ AD is a high level signal. That is, when the switch is open, the switch detection circuit 310 detects the second electrical signal greater than the second threshold at the second moving end 3. The main control unit 330 can determine that the switch is in the off state according to the high level signal at the MCU _ AD.
In one embodiment, after determining that the switch module is in the off state, the method may further include the following step S221.
S221: and clearing all the detected related variables.
When the main control unit 330 determines that the switch module 100 is in the off state according to the second electrical signal detected by the switch detection circuit 310, the MCU may zero all the detected relevant variables. The data instability that prevents to detect leads to electric tool to appear the shake or unnecessary problems such as noise intensity, optimizes user's use and experiences.
Since the control module 300 may be in an unstable state when frequently turned on and off, the protection mechanism of the motor circuit may be triggered with a probability in an unnecessary case. By using the switch action detection method, unreasonable variation in software can be cleared through the action of the switch. The MCU clears the relevant variables when detecting the switch-off instant, so that it can be ensured that the re-detected relevant variables are not wrong values when the next fast boot is performed, and the control module 300 can reasonably determine the validity of the collected data.
In one embodiment, before acquiring the first electrical signal at the common end and the second electrical signal at the second movable end, the method may further include setting the detection judgment time of the relevant variable to be greater than a preset threshold value. The preset threshold may be a time required from when the switch is turned off to when the MCU is completely powered off, that is, after the MCU is turned on, the MCU waits for a certain time to perform a data acquisition action, thereby preventing the detected relevant variable from being an unreasonable value. According to the embodiment of the disclosure, by setting the detection judgment time of the MCU related variable to be greater than the preset threshold value and prolonging the detection judgment time of the related parameter to be greater than the power-down time of the control module 300 by using software, the validity of the collected data can be ensured under the condition of not detecting the switch action, so that the operation stability of the control module 300 is improved.
It should be understood that, although the steps in the flowcharts of the figures in the specification are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not limited to being performed in the exact order illustrated and, unless explicitly stated herein, may be performed in other orders. Moreover, at least a part of the steps in the flowcharts of the figures of the specification may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of performing the steps or stages is not necessarily sequential, but may be performed alternately or alternately with other steps or at least a part of the steps or stages in other steps.
It is to be understood that the various embodiments of the method, apparatus, etc. described above are described in a progressive manner, and like/similar elements may be referred to one another, where each embodiment focuses on differences from the other embodiments. Reference may be made to the description of other method embodiments for relevant points.
Fig. 5 is a schematic structural diagram of an apparatus for implementing a switching operation detection method in an embodiment of the present disclosure. Referring to fig. 5, the switch action detection device S00 may include a processing component S20, which further includes one or more processors, and memory resources, represented by memory S22, for storing instructions, e.g., applications, executable by the processing component S20. The application stored in the memory S22 may include one or more modules each corresponding to a set of instructions. Furthermore, the processing component S20 is configured to execute instructions to perform the above-described switching action detection method.
The switching operation detection device S00 may further include: the power supply module S24 is configured to perform power management of the switching motion detection device S00, the wired or wireless network interface S26 is configured to connect the switching motion detection device S00 to a network, and the input/output (I/O) interface S28. The switch actuation detection means S00 may be operatively based on an operating system stored in the memory S22, such as Windows Server, mac OS X, unix, linux, freeBSD or the like.
In an exemplary embodiment, a computer-readable storage medium comprising instructions, such as the memory S22 comprising instructions, executable by a processor of the switch actuation detection device S00 to perform the above method is also provided. The storage medium may be a computer-readable storage medium, which may be, for example, a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
In an exemplary embodiment, there is also provided a computer program product comprising instructions executable by a processor of the switching action detection device S00 to perform the above method.
In one embodiment, a computer device is provided, the computer device may be a server, an internal structure diagram of the computer device may be as shown in fig. 6, and fig. 6 is an internal structure diagram of the computer device in one embodiment of the disclosure. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer device is used for storing the relevant data used in the switch action detection method. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a switching action detection method.
Those skilled in the art will appreciate that the architecture shown in fig. 6 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, databases, or other media used in the embodiments provided herein can include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high-density embedded nonvolatile Memory, resistive Random Access Memory (ReRAM), magnetic Random Access Memory (MRAM), ferroelectric Random Access Memory (FRAM), phase Change Memory (PCM), graphene Memory, and the like. Volatile Memory can include Random Access Memory (RAM), external cache Memory, and the like. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others. The databases involved in the embodiments provided herein may include at least one of relational and non-relational databases. The non-relational database may include, but is not limited to, a block chain based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic devices, quantum computing based data processing logic devices, etc., without limitation.
All the embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the hardware + program class embodiment, since it is substantially similar to the method embodiment, it is relatively simple to describe, and reference may be made to part of the description of the method embodiment for relevant points.
It should be noted that, the descriptions of the above-mentioned apparatuses, electronic devices, servers, and the like according to the method embodiments may also include other embodiments, and specific implementations may refer to the descriptions of the related method embodiments. Meanwhile, the new embodiment formed by mutually combining the features of the methods, the apparatuses, the devices and the server embodiments still belongs to the implementation range covered by the present disclosure, and the details are not repeated herein.
In the description herein, references to "some embodiments," "other embodiments," "desired embodiments," or the like, mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, a schematic description of the above terminology may not necessarily refer to the same embodiment or example.
All possible combinations of the technical features of the above embodiments may not be described for the sake of brevity, but should be considered as within the scope of the present disclosure as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present invention, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that various changes and modifications can be made by those skilled in the art without departing from the spirit of the invention, and these changes and modifications are all within the scope of the invention. Therefore, the protection scope of the present patent should be subject to the appended claims.

Claims (10)

1. A switch action detection circuit is characterized by comprising a switch module, a power module and a control module, wherein the switch module comprises a public end, a first movable end and a second movable end, the anode of the power module is connected with the first movable end, the cathode of the power module is connected with the cathode of the control module, and the anode of the control module is connected with the public end;
the control module comprises a switch detection circuit, a voltage detection circuit and a main control unit, the switch detection circuit is respectively connected with the second movable end and the main control unit, and the voltage detection circuit is respectively connected with the public end and the main control unit;
the voltage detection circuit is used for detecting a first electric signal at the common end;
the switch detection circuit is used for detecting a second electric signal at the second movable end;
the main control unit is used for determining the switching action of the switching module according to the first electric signal and/or the second electric signal.
2. The switching behavior detection circuit according to claim 1, wherein the switching behavior detection circuit comprises a first resistor, a second resistor, a third resistor, a fourth resistor, a fifth resistor, a zener diode, a first capacitor, and a first field effect transistor,
the first end of the first resistor is connected with the second movable end, the second end of the first resistor is connected with the drain electrode of the first field effect transistor, the grid electrode of the first field effect transistor is respectively connected with the first end of the fourth resistor, the first end of the fifth resistor and the anode of the voltage stabilizing diode, the source electrode of the first field effect transistor is respectively connected with the first end of the second resistor and the first end of the third resistor, the second end of the fifth resistor is connected with a power supply, the second end of the second resistor is respectively connected with the first end of the first capacitor and the main control unit, and the second end of the first capacitor, the second end of the third resistor, the second end of the fourth resistor and the cathode of the voltage stabilizing diode are all grounded.
3. The switching operation detection circuit according to claim 1 or 2, wherein the power supply module is a dc power supply that outputs a predetermined electrical signal.
4. A switching operation detection method applied to the switching operation detection circuit according to any one of claims 1 to 3, wherein the switching operation detection circuit includes a switch module, and the switch module includes a common terminal and a second movable terminal, and the method includes:
acquiring a first electric signal at the common end and a second electric signal at the second movable end 3;
determining a switching action of the switching module from the first electrical signal and/or the second electrical signal.
Preferably, when the first electrical signal is greater than a first threshold and the second electrical signal is less than or equal to a second threshold, it is determined that the switch module is in a closed state.
Preferably, when the second electrical signal is greater than a second threshold, it is determined that the switch module is in an off state.
5. The switching action detection method according to claim 4, wherein after determining that the switching module is in the closed state, the method further comprises:
and detecting the states of all the pins and setting the detection judgment time of the related variables.
6. The switching action detection method according to claim 4, wherein after determining that the switching module is in the off state, the method further comprises:
and clearing all the detected related variables.
7. The switching action detection method of claim 4, wherein prior to obtaining the first electrical signal at the common terminal and the second electrical signal at the second moving terminal, the method further comprises:
and setting the detection judgment time of the relevant variable to be larger than a preset threshold value.
8. A computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor when executing the computer program implements the steps of the switching action detection method of any one of claims 4 to 7.
9. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the switching action detection method according to any one of claims 4 to 7.
10. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, carries out the steps of the switching action detection method of any one of claims 4 to 7.
CN202211535658.3A 2022-12-02 2022-12-02 Switching operation detection circuit, switching operation detection method, computer device, and storage medium Pending CN115754703A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211535658.3A CN115754703A (en) 2022-12-02 2022-12-02 Switching operation detection circuit, switching operation detection method, computer device, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211535658.3A CN115754703A (en) 2022-12-02 2022-12-02 Switching operation detection circuit, switching operation detection method, computer device, and storage medium

Publications (1)

Publication Number Publication Date
CN115754703A true CN115754703A (en) 2023-03-07

Family

ID=85342539

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211535658.3A Pending CN115754703A (en) 2022-12-02 2022-12-02 Switching operation detection circuit, switching operation detection method, computer device, and storage medium

Country Status (1)

Country Link
CN (1) CN115754703A (en)

Similar Documents

Publication Publication Date Title
US6141764A (en) Method for initializing an electronic device using a dual-state power-on-reset circuit
US8547147B2 (en) Power-on-reset circuit and reset method
US5790873A (en) Method and apparatus for power supply switching with logic integrity protection
JP2001245437A (en) Discharge-control circuit
JP5368508B2 (en) In-vehicle electronic control unit
US8963574B2 (en) Circuit and method for detecting a fault attack
CN102959488B (en) For controlling the method and system of supply voltage
JPH10133758A (en) Current sensing start-up circuit for reference voltage circuit
KR100271951B1 (en) Power-on reset circuit
CN115754703A (en) Switching operation detection circuit, switching operation detection method, computer device, and storage medium
JP3479060B2 (en) Startup circuit
JP3658042B2 (en) Initialization circuit
CN116829963A (en) Self-locking detection circuit, device and control method
CN108111150B (en) Power-on reset circuit, integrated circuit and EEPROM system
CN110417389B (en) Power-on reset circuit
CN211830191U (en) Under-voltage locking circuit
JP2703890B2 (en) Semiconductor integrated circuit
JPH07141894A (en) Protective circuit
CN108376015B (en) Mirror circuit and power management chip
JPH07253830A (en) Circuit and method for generating reset signal
CN221448381U (en) DC power supply slow start switch circuit
KR101840379B1 (en) Semiconductor device
CN218332520U (en) Power supply voltage control circuit
JP4350854B2 (en) State maintaining circuit device to be controlled and state maintaining method
WO2022222041A1 (en) Tamper detection memory save with delay

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination