Switch state detection method, circuit and electronic device
By using the auxiliary detection module in the switch state detection circuit to dynamically increase the load resistance and increase the current flowing through the switch to break down the oxide layer, the problems of false detection and high power consumption are solved, and more accurate detection and lower power consumption are achieved. power consumption.
Patent Information
- Application Number
- CN202410502049.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-25
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2044-04-25
AI Technical Summary
Existing switch state detection methods cannot penetrate the metal oxide layer due to insufficient current flowing through the contacts during detection, resulting in false detection. Increasing the current to improve detection accuracy will lead to an increase in overall power consumption, especially in multi-purpose switches. Heat and cost issues are prominent in channel input circuits.
Use the auxiliary detection module to dynamically increase the load resistance in the detection loop, increase the current flowing through the switch to be detected to break down the metal oxide layer, and disconnect the load resistance after the detection is completed to avoid adding a constant resistance to the main detection module. Reduce power consumption.
It improves the accuracy of the processor's switch state detection, reduces false detections, and significantly reduces the power consumption of the overall switch state detection circuit, avoiding the increase in heat and cost caused by high power consumption.
Smart Images

Figure CN118112409B
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of switch state detection, and in particular to a switch state detection method, circuit and electronic device. Background Art
[0002] The state of the switch (on or off) is a common input signal of the control system and needs to be reliably detected by the control core such as the processor. Therefore, it is necessary to design the corresponding switch signal processing circuit and software detection algorithm.
[0003] The relevant detection method is to input the input voltage of the switch into the corresponding control unit (such as a photoelectric isolator) after voltage division. By setting appropriate on- and off-thresholds, the on- and off-state of the switch correspond to the high and low levels output by the control unit. The high and low levels are input to the processor for switch status detection. Summary of the invention
[0004] The present application provides a switch state detection method, circuit and electronic device, which can improve the accuracy of the processor's switch state detection and reduce false detection phenomena.
[0005] In a first aspect, the present application provides a switch state detection circuit, which includes: a processor; at least one main detection module, the input end of each main detection module is coupled to a switch to be detected, and the output end of each main detection module is coupled to the processor; an auxiliary detection module, the control end of the auxiliary detection module is coupled to the processor, the first input end of the auxiliary detection module is coupled to the input end of the main detection module, and the second input end of the auxiliary detection module is coupled to the voltage dividing node of the main detection module; wherein the voltage dividing node is located after the input end of the main detection module; wherein the auxiliary detection module responds to the first control signal of the processor, and the switch to be detected is in the on state, and connects the load resistor in the auxiliary detection module to the main detection module, thereby increasing the current flowing through the switch to be detected, so that the processor performs switch state detection.
[0006] Wherein, the auxiliary detection module includes: at least one first input terminal, each first input terminal is respectively coupled to an input terminal of a main detection module; at least one second input terminal, each second input terminal is respectively coupled to a voltage-dividing node of the main detection module; a first control unit, the first terminal of the first control unit is coupled to the working power supply terminal, the second terminal of the first control unit is coupled to the processor as the control terminal of the auxiliary detection module, and the fourth terminal of the first control unit is coupled to at least one second input terminal; a switch unit, the control terminal of the switch unit is coupled to the third terminal of the first control unit, the first terminal of the switch unit is coupled to at least one first input terminal through a load resistor, and the second terminal of the switch unit is grounded; wherein, the second terminal of the first control unit responds to the first control signal of the processor, and the third terminal and the fourth terminal of the first control unit are turned on; the switch unit responds to the switch to be detected being in the on state, connects the load resistor to the main detection module, increases the current flowing through the switch to be detected, so that the processor performs switch state detection.
[0007] Each load resistor is coupled to the first end of the switch unit through a diode; wherein the anode of the diode is coupled to the load resistor, and the cathode of the diode is coupled to the first end of the switch unit.
[0008] Each second input terminal is coupled to the fourth terminal of the first control unit through a diode; wherein the anode of the diode is coupled to the second input terminal, and the cathode of the diode is coupled to the fourth terminal of the first control unit.
[0009] The auxiliary detection module further includes: a first voltage divider unit, a first end of the first voltage divider unit is coupled to the third end of the first control unit, a second end of the first voltage divider unit is coupled to the control end of the switch unit, and a third end of the first voltage divider unit is grounded.
[0010] Wherein, each main detection module includes: a second voltage divider unit, a first end of the second voltage divider unit is coupled to the first input end of the auxiliary detection module and the switch to be detected as the input end of the main detection module, and a voltage divider node of the second voltage divider unit is coupled to the second input end of the auxiliary detection module; a second control unit, a first end of the second control unit is coupled to the second end of the second voltage divider unit, a second end of the second control unit is coupled to the negative pole of the power supply, a third end of the second control unit is grounded, and a fourth end of the second control unit is coupled to the processor as the output end of the main detection module.
[0011] Among them, the processor responds to the first power-on detection of the switch state detection circuit and outputs a low-level first control signal of a preset time. The auxiliary detection module responds to the low-level first control signal and connects the load resistor to the main detection module to increase the current flowing through the switch to be detected, so as to break through the metal oxide layer on the corresponding contacts of the switch to be detected.
[0012] The processor outputs the first control signal in a PWM manner in response to completion of the first power-on detection.
[0013] In a second aspect, the present application provides an electronic device, comprising a switch state detection circuit as provided in the first aspect.
[0014] In a third aspect, the present application provides a switch state detection method, which is applied to a switch state detection circuit, and the switch state detection circuit includes: a processor; at least one main detection module, the input end of each main detection module is coupled to a switch to be detected, and the output end of each main detection module is coupled to the processor; an auxiliary detection module, the control end of the auxiliary detection module is coupled to the processor, the first input end of the auxiliary detection module is coupled to the input end of the main detection module, and the second input end of the auxiliary detection module is coupled to the voltage divider node of the main detection module; wherein the voltage divider node is located after the input end of the main detection module; the method includes: the auxiliary detection module responds to a first control signal sent by the processor, and the switch to be detected is in an on state, connects the load resistor in the auxiliary detection module to the main detection module, and increases the current flowing through the switch to be detected, so that the processor performs switch state detection.
[0015] The beneficial effects of the present application are as follows: Different from the prior art, the switch state detection method, circuit and electronic device provided by the present application utilize the auxiliary detection module to dynamically increase the load resistance in the detection loop, thereby increasing the current flowing through the switch to be detected, which can break through the metal oxide layer on the contact of the switch to be detected, improve the accuracy of the processor's switch state detection, and reduce the phenomenon of false detection. Furthermore, the auxiliary detection module is dynamically connected to the load resistance to avoid adding a constant resistance to the main detection module, thereby reducing the power consumption of the overall switch state detection circuit. For example, the load resistance is disconnected after the detection is completed, which can greatly reduce the overall power consumption. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. Among them:
[0017] Figure 1 It is a structural schematic diagram of an embodiment of a switch state detection circuit in the related art provided by this application;
[0018] Figure 2 yes Figure 1 The corresponding detection timing diagram;
[0019] Figure 3 is a structural schematic diagram of an embodiment of a switch state detection circuit provided by the present application;
[0020] Figure 4 It is a structural schematic diagram of an embodiment of a main detection module in a switch state detection circuit provided by the present application;
[0021] Figure 5 It is a structural schematic diagram of an embodiment of an auxiliary detection module in a switch state detection circuit provided by the present application;
[0022] Figure 6 This application provides Figure 4 and Figure 5 The corresponding detection timing diagram;
[0023] Figure 7 It is a structural schematic diagram of an embodiment of an electronic device provided by the present application. DETAILED DESCRIPTION
[0024] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It will be understood that the specific embodiments described herein are only used to explain the present application, rather than to limit the present application. It should also be noted that, for ease of description, only some but not all structures related to the present application are shown in the drawings. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0025] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0026] The state of the switch (on or off) is a common input signal of the control system and needs to be reliably detected by the control core such as the processor. Therefore, it is necessary to design the corresponding switch signal processing circuit and software detection algorithm.
[0027] A related detection method is to input the input voltage of the switch into a corresponding control unit (such as an optoelectronic isolator) after voltage division. By setting appropriate on- and off-threshold values, the on- and off-states of the switch correspond to high and low levels output by the control unit. The high and low levels are input to the processor 10 for switch status detection.
[0028] like Figure 1 and Figure 2As shown, after the switch K1 is turned on, the current passes through K1 from the positive electrode of the power supply (Vin+), and then passes through the current limiting resistor R1 to enter the optoelectronic isolator P1. After the optoelectronic isolator P1 is turned on and the secondary transistor is turned on, the 4th pin of the optoelectronic isolator P1 is at a low level. The signal passes through the resistor R3 and the capacitor C1 for filtering and is sent to the processor I / O pin (OIN1) for detection, wherein the 3rd pin of the optoelectronic isolator P1 is coupled to the digital ground DGND, one end of the resistor R4 is coupled to the 4th pin of the optoelectronic isolator P1, and the other end of the resistor R4 is coupled to the positive digital power supply voltage DVCC3_3, one end of the resistor R2 is coupled to the end of the current limiting resistor R1 away from the switch K1, and the other end of the resistor R2 is coupled to the negative electrode of the power supply (Vin-).
[0029] The applicant has found through long-term research that common switches, such as contactor contacts, are affected by the oxide layer on the surface of the contacts. They require that the current flowing through the contacts is greater than a threshold value (such as 10mA) in order to be reliably conductive. Otherwise, even if the contactor contacts are mechanically in contact, the loop current is too small to break through the oxide layer on the surface of the contacts, and the current cannot reliably pass through the contacts. The processor cannot detect the closed state of the contactor contacts, resulting in false detection.
[0030] If the input voltage is adjusted Figure 1 The resistance value of the current limiting resistor R1 makes the current flowing through R1 greater than the threshold value (10mA). After the switch is closed, the input voltage continues to pass through the current limiting resistor R1 and the primary side of the optocoupler and generates power consumption. When the input voltage is high, such as 110Vdc, 220Vac, a large power consumption will be generated in the input circuit and cause serious heating of the internal components of the product. This problem will be more prominent in the case of products with multi-channel input circuits. Some products, such as PLC, usually have 10 or even dozens of switch input detection channels. If the current greater than the threshold value continues to pass through the input circuit, the power consumption of each channel is greater than 1W or 2W. The heating of the multi-input channel circuit requires additional heat dissipation measures, which will lead to many problems such as increased product volume, reduced reliability, and increased costs.
[0031] Based on this, the present application proposes to use an auxiliary detection module to dynamically increase the load resistance in the detection loop, thereby increasing the current flowing through the switch to be detected, which can break through the metal oxide layer on the contact of the switch to be detected, improve the accuracy of the processor's switch state detection, and reduce the phenomenon of false detection. Furthermore, by using the auxiliary detection module to dynamically connect the load resistance, it is avoided to add a constant resistance to the main detection module, thereby reducing the power consumption of the overall switch state detection circuit. For example, after the detection is completed, the load resistance is disconnected, which can greatly reduce the overall power consumption and solve at least one of the above technical problems. Please refer to the following embodiments for details.
[0032] See also Figure 3 , Figure 31 is a schematic diagram of a switch state detection circuit according to an embodiment of the present application. The switch state detection circuit 100 comprises: a processor 10 , an auxiliary detection module 20 and at least one main detection module 30 .
[0033] The input end of each main detection module 30 is coupled to a switch to be detected, and the output end of each main detection module 30 is coupled to the processor 10. That is, the number of main detection modules 30 can correspond to the number of switches to be detected. If the number of switches to be detected is N, the number of main detection modules 30 is also N. The output end of each main detection module 30 is coupled to a different pin of the processor 10, so that the processor 10 can clearly know whether the corresponding switch to be detected is turned on or off.
[0034] The control end of the auxiliary detection module 20 is coupled to the processor 10, the first input end of the auxiliary detection module 20 is coupled to the input end of the main detection module 30, and the second input end of the auxiliary detection module 20 is coupled to the voltage-dividing node of the main detection module 30; wherein the voltage-dividing node is located after the input end of the main detection module 30. In this embodiment, the number of the first input ends of the auxiliary detection module 20 corresponds to the number of the main detection modules 30. That is, the auxiliary detection module 20 may include a plurality of first input ends, each of which is coupled to the input end of a main detection module 30. In this embodiment, the number of the second input ends of the auxiliary detection module 20 corresponds to the number of the main detection modules 30. That is, the auxiliary detection module 20 may include a plurality of second input ends, each of which is coupled to the voltage-dividing node of a main detection module 30. It can be understood that the first input end and the second input end correspond to each other, that is, the same group of first input ends and second input ends are coupled to the same main detection module 30.
[0035] In this embodiment, the auxiliary detection module 20 includes a load resistor. The auxiliary detection module 20 responds to the first control signal of the processor 10, and the switch to be detected is in the on state, and the load resistor in the auxiliary detection module 20 is connected to the main detection module 30 to increase the current flowing through the switch to be detected, so that the processor 10 performs switch state detection. In this embodiment, if the switch to be detected is in the off state, even if the auxiliary detection module 20 receives the first control signal of the processor 10, the load resistor in the auxiliary detection module 20 will not be connected to the main detection module 30 to participate in the switch state detection. At this time, the processor 10 can determine that the switch to be detected is in the off state through the main detection module 30.
[0036] In this embodiment, the auxiliary detection module 20 is used to dynamically increase the load resistance in the detection loop, thereby increasing the current flowing through the switch to be detected, which can break through the metal oxide layer on the contact of the switch to be detected, improve the accuracy of the processor 10 in detecting the switch state, and reduce the false detection phenomenon. Further, the auxiliary detection module 20 is used to dynamically connect the load resistance to avoid adding a constant resistance to the main detection module 30, thereby reducing the power consumption of the overall switch state detection circuit. For example, the load resistance is disconnected after the detection is completed, which can greatly reduce the overall power consumption.
[0037] In some embodiments, the auxiliary detection module 20 includes: at least one first input terminal, at least one second input terminal, a first control unit and a switch unit, wherein the number of the first input terminal and the second input terminal can be determined according to the number of switches to be detected.
[0038] Each first input terminal is respectively coupled to an input terminal of a main detection module 30 .
[0039] Each second input terminal is respectively coupled to a voltage division node of the main detection module 30 .
[0040] A first terminal of the first control unit is coupled to the working power terminal, a second terminal of the first control unit is coupled to the processor 10 as a control terminal of the auxiliary detection module 20, and a fourth terminal of the first control unit is coupled to at least one second input terminal.
[0041] The control terminal of the switch unit is coupled to the third terminal of the first control unit, the first terminal of the switch unit is coupled to at least one first input terminal through a load resistor, and the second terminal of the switch unit is grounded. In some embodiments, each first input terminal is coupled to the first terminal of the switch unit through a load resistor.
[0042] The second end of the first control unit responds to the first control signal of the processor 10, and the third and fourth ends of the first control unit are turned on; the switch unit responds to the switch to be detected being in the on state, connects the load resistor to the main detection module 30, and increases the current flowing through the switch to be detected, so that the processor 10 performs switch state detection. In some embodiments, the first control unit can be a photoelectric isolator.
[0043] Further, in response to the switch to be detected being in the disconnected state, the switch unit does not connect the load resistor to the main detection module 30, and the processor 10 only detects that the switch to be detected is in the disconnected state through the main detection module 30. In some embodiments, the switch unit can be composed of switch elements such as MOS tubes.
[0044] In this embodiment, the second end of the first control unit responds to the first control signal of the processor 10, and the third and fourth ends of the first control unit are turned on. When the switch to be detected is in the on state, a high level will flow into the control end of the switch unit through the first control unit to turn on the switch unit, connect the load resistor to the main detection module 30, increase the current flowing through the switch to be detected, so that the processor 10 can perform switch state detection, improve the accuracy of the processor 10 in detecting the switch state, and reduce false detection.
[0045] Furthermore, each load resistor is coupled to the first end of the switch unit through a diode; wherein the anode of the diode is coupled to the load resistor, and the cathode of the diode is coupled to the first end of the switch unit.
[0046] Each second input terminal is coupled to the fourth terminal of the first control unit through a diode; wherein the anode of the diode is coupled to the second input terminal, and the cathode of the diode is coupled to the fourth terminal of the first control unit, thereby isolating the detection channels from each other.
[0047] Furthermore, the auxiliary detection module 20 also includes: a first voltage divider unit, a first end of the first voltage divider unit is coupled to the third end of the first control unit, a second end of the first voltage divider unit is coupled to the control end of the switch unit, and a third end of the first voltage divider unit is grounded.
[0048] Furthermore, each main detection module 30 includes: a second voltage dividing unit and a second control unit.
[0049] The first end of the second voltage dividing unit is coupled to the first input end of the auxiliary detection module 20 and the switch to be detected as the input end of the main detection module 30 , and the voltage dividing node of the second voltage dividing unit is coupled to the second input end of the auxiliary detection module 20 .
[0050] The first end of the second control unit is coupled to the second end of the second voltage divider unit, the second end of the second control unit is coupled to the negative pole of the power supply, the third end of the second control unit is grounded, and the fourth end of the second control unit is coupled to the processor 10 as the output end of the main detection module 30.
[0051] In one application scenario, the processor 10 outputs a low-level first control signal of a preset time in response to the first power-on detection of the switch status detection circuit. The auxiliary detection module 20 responds to the low-level first control signal by connecting a load resistor to the main detection module 30 to increase the current flowing through the switch to be detected, so as to break through the metal oxide layer on the corresponding contacts of the switch to be detected.
[0052] Furthermore, in response to the completion of the first power-on detection, the processor 10 outputs the first control signal in a PWM manner. Since the metal oxide layer on the corresponding contact of the switch to be detected is broken down during the first detection, no continuous control signal is required subsequently, so the first control signal can be output in a PWM manner to save power consumption.
[0053] In one application scenario, combined with Figure 4 , Figure 5 and Figure 6 To explain:
[0054] like Figure 4 Provides 8-way main detection module, which is understandable. Figure 4 Only the first main detection module and the eighth main detection module are shown, and the other main detection modules are omitted. Among them, R10 and R11 in the first main detection module can constitute the above-mentioned second voltage divider unit. The photoelectric isolator P10 can be the above-mentioned second control unit. When the switch K10 is turned on, the current flows from the positive electrode of the power supply (Vin+) through K10, and then through the resistors R10 and R11, and enters the optoelectronic isolator P10. When the optoelectronic isolator P10 is turned on and the secondary transistor is turned on, the 4th pin of the optoelectronic isolator P10 is at a low level. The signal passes through the resistor R14 and the capacitor C11 for filtering and is sent to the processor I / O pin (OIN10) for detection. Among them, the 3rd pin of the optoelectronic isolator P10 is coupled to the digital ground DGND, one end of the resistor R13 is coupled to the 4th pin of the optoelectronic isolator P10, and the other end of the resistor R13 is coupled to the positive digital power supply voltage DVCC3_3, one end of the resistor R12 is coupled to the end of the resistor R11 away from the switch K10, and the other end of the resistor R12 is coupled to the negative electrode of the power supply (Vin-). Among them, after the switch K17 is turned on, the current passes through K17 from the positive electrode of the power supply (Vin+), and then passes through resistors R36 and R37 to enter the optoelectronic isolator P17. After the optoelectronic isolator P17 is turned on and the secondary transistor is turned on, the 4th pin of the optoelectronic isolator P17 is at a low level. The signal passes through the resistor R40 and the capacitor C17 for filtering and is sent to the processor I / O pin (OIN17) for detection. Among them, the 3rd pin of the optoelectronic isolator P17 is coupled to the digital ground DGND, one end of the resistor R39 is coupled to the 4th pin of the optoelectronic isolator P17, and the other end of the resistor R39 is coupled to the positive digital power supply voltage DVCC3_3, one end of the resistor R38 is coupled to the end of the resistor R37 away from the switch K17, and the other end of the resistor R38 is coupled to the negative electrode of the power supply (Vin-).
[0055] like Figure 5 An auxiliary detection module having eight first input terminals and a second input terminal is provided. Figure 5 The middle switch tube Q1 may be the switch unit mentioned above. The photoelectric isolator P50 may be the first control unit mentioned above. Figure 5 R50 and R49 in the circuit constitute the first voltage dividing unit mentioned above.
[0056] Combination Figure 4 , Figure 5 and Figure 6 To explain, at the moment T1 after the product completes power-on reset and initialization, the processor pulls the control signal DI_PWM down for a duration Td, the primary side of the optoelectronic isolator P50 is turned on, and in the 8-channel input circuit, Figure 4 As long as any one of the switches K10~K17 is turned on, one of the corresponding RIN10~RIN17 nodes will obtain a suitable high level through resistor voltage division. This high level passes through one of the diodes D9~D16, making the pin 3 of the optoelectronic isolator P50 become a high level. Through the voltage division of R50 and R49, the switch tube Q1 is driven to turn on, and the load resistors R41~R49 of each input channel are connected to the corresponding channel. For example, the load resistor R41 is coupled between the resistor R10 and the switch K10 through the node IN11. For example, the load resistor R48 is coupled between the resistor R36 and the switch K17 through the node IN17. The processor samples the switch status of the 8 channels at time T2, and after the processor completes the judgment of the switch status of the 8 channels, it turns off the switch tube Q1 to reduce power consumption.
[0057] If all 8 switches are in the disconnected state, the 4th pin of the photoelectric isolator P50 is at a low level, the switch tube Q1 will not be turned on, and the 8-way resistive load will not be connected. Figure 4 However, since the switch state is disconnected at this time, the absence of a fixed resistance load does not affect the processor's judgment of the switch state.
[0058] During the first power-on test, the switch tube Q1 is not controlled by PWM, but is continuously turned on for Td time. The reason is that the oxide layer on the surface of the switch is formed due to long-term inactivity. When the power is first turned on, a continuous large current is used to break down the oxide layer, and there is no need to pass a large current each time thereafter.
[0059] In order to reduce the occupation of processor pin resources, an 8-channel input is controlled by a switch tube, and D1~D8 and D9~D16 can ensure the isolation of the 8 channels.
[0060] In the subsequent switch state detection moment, the switch tube Q1 adopts PWM drive mode, which can not only ensure the instantaneous large current, but also greatly reduce the average power consumption during the period when the load resistance is put into use, and further reduce the power consumption and heat generation of the resistance load. Before the processor detects the switch state, the switch tube Q1 is turned on first, and after the detection is completed, the switch tube Q1 is turned off.
[0061] That is, in the above application scenario, when the switch is turned on, in order to increase the current flowing through the switch contacts, in addition to the current passing through the current limiting resistor and the optocoupler (the primary current of the optocoupler is 1mA, which can be reliably turned on), a fixed load resistor is added to each channel at the input circuit port, and the appropriate resistance value is selected according to the input voltage so that the current flowing through the resistor load is about 10mA. In this way, when the switch is turned on, the current flowing through the contacts is the sum of the optocoupler current and the fixed resistor load current.
[0062] The load resistance is not constantly connected to the circuit. In order to reduce the power consumption of the circuit, the resistance load is connected at the appropriate time through the control algorithm and driven by PWM (Pulse Width Modulation). After the detection is completed, the resistance load is turned off, which can greatly reduce the overall power consumption.
[0063] See also Figure 7 , Figure 7 2 is a schematic diagram of the structure of an electronic device according to an embodiment of the present application, wherein the electronic device 200 includes a switch state detection circuit 100. The switch state detection circuit 100 is the switch state detection circuit 100 of any of the above embodiments.
[0064] In the present application, a switch state detection method is also provided. It is applied to a switch state detection circuit, and the switch state detection circuit is applied to a switch state detection circuit. The method includes: the auxiliary detection module 20 responds to a first control signal sent by the processor 10, and the switch to be detected is in the on state, and the load resistor in the auxiliary detection module 20 is connected to the main detection module 30, and the current flowing through the switch to be detected is increased, so that the processor 10 performs switch state detection.
[0065] In summary, the switch state detection method, circuit, and electronic device provided by the present application utilize the auxiliary detection module 20 to dynamically increase the load resistance in the detection loop, thereby increasing the current flowing through the switch to be detected, which can break through the metal oxide layer on the contacts of the switch to be detected, improve the accuracy of the processor 10 in detecting the switch state, and reduce the phenomenon of false detection. Furthermore, by utilizing the auxiliary detection module 20 to dynamically access the load resistance, it is avoided to add a constant resistance to the main detection module 30, thereby reducing the power consumption of the overall switch state detection circuit. For example, the load resistance is disconnected after the detection is completed, which can greatly reduce the overall power consumption. That is, the technical solution of the present application can realize reliable detection of the input state of multi-channel switches under the condition that the additional power consumption is almost negligible.
[0066] In the several embodiments provided in this application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation described above is only illustrative, for example, the division of the modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.
[0067] If the integrated units in the above other embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or processor 10 (processor) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, RandomAccess Memory), disk or optical disk and other media that can store program code.
[0068] The above description is only an implementation method of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly used in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A switch state detection circuit, It is characterized in that The switch state detection circuit comprises: processor; At least one main detection module, an input end of each main detection module is coupled to a switch to be detected, and an output end of each main detection module is coupled to the processor; An auxiliary detection module, wherein a control end of the auxiliary detection module is coupled to the processor, a first input end of the auxiliary detection module is coupled to an input end of the main detection module, and a second input end of the auxiliary detection module is coupled to a voltage-dividing node of the main detection module; wherein the voltage-dividing node is located after the input end of the main detection module; Wherein, the auxiliary detection module includes: At least one first input terminal, each of the first input terminals is respectively coupled to an input terminal of the main detection module; At least one second input terminal, each of the second input terminals is respectively coupled to a voltage division node of the main detection module; a first control unit, wherein a first terminal of the first control unit is coupled to a working power terminal, a second terminal of the first control unit is coupled to the processor as a control terminal of the auxiliary detection module, and a fourth terminal of the first control unit is coupled to the at least one second input terminal; A first voltage dividing unit, wherein a first end of the first voltage dividing unit is coupled to a third end of the first control unit, and the third end of the first voltage dividing unit is grounded; A switch unit, wherein a control end of the switch unit is coupled to the second end of the first voltage dividing unit, a first end of the switch unit is coupled to the at least one first input end through a load resistor, and a second end of the switch unit is grounded; Among them, the second end of the first control unit responds to the first control signal of the processor, and the third and fourth ends of the first control unit are turned on; the switch unit responds to the switch to be detected being in the on state, connects the load resistor to the main detection module, and increases the current flowing through the switch to be detected, so that the processor performs switch state detection.
2. The switch state detection circuit according to claim 1, It is characterized in that Each of the load resistors is coupled to the first end of the switch unit through a diode; wherein the anode of the diode is coupled to the load resistor, and the cathode of the diode is coupled to the first end of the switch unit.
3. The switch state detection circuit according to claim 1, It is characterized in that Each of the second input terminals is coupled to the fourth terminal of the first control unit through a diode, wherein the anode of the diode is coupled to the second input terminal, and the cathode of the diode is coupled to the fourth terminal of the first control unit.
4. The switch state detection circuit according to claim 1, It is characterized in that Each of the main detection modules comprises: A second voltage dividing unit, wherein a first end of the second voltage dividing unit is coupled to a first input end of the auxiliary detection module and the switch to be detected as an input end of the main detection module, and a voltage dividing node of the second voltage dividing unit is coupled to a second input end of the auxiliary detection module; A second control unit, wherein the first end of the second control unit is coupled to the second end of the second voltage divider unit, the second end of the second control unit is coupled to the negative pole of the power supply, the third end of the second control unit is grounded, and the fourth end of the second control unit is coupled to the processor as the output end of the main detection module.
5. The switch state detection circuit according to claim 1, It is characterized in that The processor outputs a low-level first control signal of a preset time in response to the first power-on detection of the switch state detection circuit, and the auxiliary detection module connects the load resistor to the main detection module in response to the low-level first control signal to increase the current flowing through the switch to be detected, so as to break through the metal oxide layer on the corresponding contacts of the switch to be detected.
6. The switch state detection circuit according to claim 5, It is characterized in that In response to completion of the first power-on detection, the processor outputs the first control signal in a PWM manner.
7. An electronic device, It is characterized in that The invention comprises a switch state detection circuit as described in any one of claims 1 to 6.
8. A switch state detection method, It is characterized in that Applied to a switch state detection circuit, the switch state detection circuit comprises: a processor; at least one main detection module, the input end of each main detection module is coupled to a switch to be detected, and the output end of each main detection module is coupled to the processor; an auxiliary detection module, the control end of the auxiliary detection module is coupled to the processor, the first input end of the auxiliary detection module is coupled to the input end of the main detection module, and the second input end of the auxiliary detection module is coupled to the voltage division node of the main detection module; wherein the voltage division node is located after the input end of the main detection module; wherein the auxiliary detection module comprises: At least one first input terminal, each of the first input terminals is respectively coupled to an input terminal of the main detection module; At least one second input terminal, each of the second input terminals is respectively coupled to a voltage division node of the main detection module; a first control unit, wherein a first terminal of the first control unit is coupled to a working power terminal, a second terminal of the first control unit is coupled to the processor as a control terminal of the auxiliary detection module, and a fourth terminal of the first control unit is coupled to the at least one second input terminal; A first voltage dividing unit, wherein a first end of the first voltage dividing unit is coupled to a third end of the first control unit, and the third end of the first voltage dividing unit is grounded; A switch unit, wherein a control end of the switch unit is coupled to the second end of the first voltage dividing unit, a first end of the switch unit is coupled to the at least one first input end through a load resistor, and a second end of the switch unit is grounded; The method comprises: The second end of the first control unit responds to the first control signal of the processor, and the third and fourth ends of the first control unit are turned on; the switch unit responds to the switch to be detected being in the on state, connects the load resistor to the main detection module, and increases the current flowing through the switch to be detected, so that the processor performs switch state detection.
