CN109932647B - Toggle switch state detection circuit, method and device - Google Patents
Toggle switch state detection circuit, method and device Download PDFInfo
- Publication number
- CN109932647B CN109932647B CN201910247860.8A CN201910247860A CN109932647B CN 109932647 B CN109932647 B CN 109932647B CN 201910247860 A CN201910247860 A CN 201910247860A CN 109932647 B CN109932647 B CN 109932647B
- Authority
- CN
- China
- Prior art keywords
- toggle switch
- output port
- toggle
- detection
- state
- 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.)
- Active
Links
- 238000001514 detection method Methods 0.000 title claims abstract description 128
- 238000000034 method Methods 0.000 title description 16
- 239000004065 semiconductor Substances 0.000 claims description 3
- 239000011159 matrix material Substances 0.000 description 6
- 230000008569 process Effects 0.000 description 6
- 230000009471 action Effects 0.000 description 3
- 230000008901 benefit Effects 0.000 description 3
- 238000010586 diagram Methods 0.000 description 3
- 239000003990 capacitor Substances 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
Images
Landscapes
- Electronic Switches (AREA)
Abstract
The invention provides a toggle switch state detection circuit, a toggle switch state detection method and a toggle switch state detection device, wherein the toggle switch state detection circuit comprises: the circuit comprises a first number of toggle switch groups and output ports, a second number of detection ports and pull-up resistors, and diodes corresponding to the toggle switches. The second quantity is the maximum toggle switch number of the toggle switch group; one end of each pull-up resistor is connected with the first voltage, and the other end of each pull-up resistor is connected with each detection port; one end of each toggle switch is connected with the detection port, and the other end is connected with the anode of the corresponding diode; the detection ports connected with different toggle switches in the same group are different; the cathode of each diode is connected with an output port; when the toggle switches corresponding to the two diodes belong to the same group, the connected output ports are the same, otherwise, the output ports are different; the on-off state of the line connected with any output port can be controlled. And on-off control of the line connected with each output port is based on the level state at each detection port to determine the on-off state of each toggle switch. Therefore, the scheme can reduce the setting number of the I/O ports.
Description
Technical Field
The invention relates to the technical field of electronics, in particular to a circuit, a method and a device for detecting a toggle switch state.
Background
The existing toggle switch state detection circuit has various types.
Currently, it is common for a single switch to interface with a single I/O (input/output) port in the switch detection.
Therefore, when the number of the toggle switches is large, more I/O ports need to be arranged, and a large amount of chip hardware resources are occupied.
Disclosure of Invention
The invention provides a toggle switch state detection circuit, a toggle switch state detection method and a toggle switch state detection device, which can reduce the number of I/O ports.
In order to achieve the purpose, the invention is realized by the following technical scheme:
in a first aspect, the present invention provides a toggle switch state detection circuit, including:
the circuit comprises a first number of toggle switch groups including at least one toggle switch, a first number of output ports, a second number of detection ports, a diode corresponding to each toggle switch and a second number of pull-up resistors;
the second quantity is the number of the toggle switches in one toggle switch group, and the number of the toggle switches in any other toggle switch group is not more than the second quantity;
the first end of each pull-up resistor is connected with a first voltage, and the second end of each pull-up resistor is connected with the detection ports of the second number in a one-to-one correspondence manner;
the first end of each toggle switch is connected with one detection port, and in the same toggle switch group, the detection ports connected with different toggle switches are different;
the anode of each diode is connected with the second end of the corresponding toggle switch, and the cathode of each diode is connected with one output port;
for any two diodes, when the toggle switches respectively corresponding to the two diodes belong to the same toggle switch group, the output ports connected with the two diodes are the same, and when the toggle switches respectively corresponding to the two diodes do not belong to the same toggle switch group, the output ports connected with the two diodes are different;
the on-off state of a line connected with any one output port can be controlled.
Further, the toggle switch state detection circuit further comprises: an NMOS (N-Metal-Oxide-Semiconductor) transistor corresponding to each of the output ports;
the source electrode of each NMOS transistor is grounded;
the grid electrode of each NMOS transistor is connected with a corresponding output circuit;
the cathode of each diode is connected with the drain electrode of an NMOS transistor so as to be connected with the output port corresponding to the NMOS transistor.
Further, the output port is configured as an N-channel open-drain output.
Further, the toggle switch state detection circuit further comprises: a filter circuit corresponding to each detection port;
the first end of each filter circuit is connected with the corresponding detection port, and the second end of each filter circuit is grounded.
Furthermore, the number of the toggle switches in any toggle switch group is the second number.
In a second aspect, the present invention provides a toggle switch state detection method based on any one of the above toggle switch state detection circuits, including:
sequentially aiming at each output port, executing the following steps:
controlling the connection of the line connected with the current output port and the disconnection of the line connected with any other output port;
aiming at each target toggle switch, the target toggle switch is connected with the toggle switch of the current output port, and all the steps are executed as follows:
and determining the switch state of the current target toggle switch according to the level state at the detection port connected with the current target toggle switch.
Furthermore, the toggle switch state detection circuit comprises an NMOS transistor corresponding to each output port;
the source electrode of each NMOS transistor is grounded;
the grid electrode of each NMOS transistor is connected with a corresponding output circuit;
the cathode of each diode is connected with the drain electrode of an NMOS transistor so as to be connected with the output port corresponding to the NMOS transistor;
the controlling the circuit connected with the current output port to be conducted comprises: controlling the current output port to output the first voltage so as to enable the NMOS transistor corresponding to the current output port to be conducted;
the control of the disconnection of the line connected with any other output port comprises the following steps: and controlling any other output port to output zero level so as to make the NMOS transistor corresponding to any other output port not be conducted.
Further, the output port is configured as an N-channel open-drain output;
the controlling the circuit connected with the current output port to be conducted comprises: setting the current N-channel open-drain output port to be in a 0 level state so as to enable a line connected with the current N-channel open-drain output port to be conducted;
the control of the disconnection of the line connected with any other output port comprises the following steps: and setting any other N-channel open-drain output port to be in an open circuit state so as to disconnect the lines connected with any other N-channel open-drain output port.
Further, the determining the switch state of the current target toggle switch according to the level state at the detection port connected to the current target toggle switch includes:
reading the level state of a detection port connected with a current target toggle switch;
when the read level state is a high level, determining that the switch state of the current target toggle switch is off;
and when the read level state is a low level, determining that the switch state of the current target toggle switch is closed.
In a third aspect, the present invention provides a toggle switch state detection device based on any one of the above toggle switch state detection circuits, including:
a control unit, configured to execute, for each of the output ports in turn: controlling the connection of the line connected with the current output port and the disconnection of the line connected with any other output port;
the detection unit is used for aiming at each target toggle switch, and the target toggle switches are connected with the toggle switch of the current output port and all execute the following steps: and determining the switch state of the current target toggle switch according to the level state at the detection port connected with the current target toggle switch.
The invention provides a toggle switch state detection circuit, a toggle switch state detection method and a toggle switch state detection device, wherein the toggle switch state detection circuit comprises: the circuit comprises a first number of toggle switch groups and output ports, a second number of detection ports and pull-up resistors, and diodes corresponding to the toggle switches. The second quantity is the maximum toggle switch number of the toggle switch group; one end of each pull-up resistor is connected with the first voltage, and the other end of each pull-up resistor is connected with each detection port; one end of each toggle switch is connected with the detection port, and the other end is connected with the anode of the corresponding diode; the detection ports connected with different toggle switches in the same group are different; the cathode of each diode is connected with an output port; when the toggle switches corresponding to the two diodes belong to the same group, the connected output ports are the same, otherwise, the output ports are different; the on-off state of the line connected with any output port can be controlled. And on-off control of the line connected with each output port is based on the level state at each detection port to determine the on-off state of each toggle switch. Therefore, the invention can reduce the setting number of the I/O ports.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
Fig. 1 is a schematic diagram of a toggle switch state detection circuit according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of another toggle state detection circuit according to an embodiment of the present invention;
FIG. 3 is a flow chart of a toggle switch state detection method according to an embodiment of the present invention;
fig. 4 is a schematic diagram of a toggle switch state detection apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer and more complete, the technical solutions in the embodiments of the present invention will be described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention, and based on the embodiments of the present invention, all other embodiments obtained by a person of ordinary skill in the art without creative efforts belong to the scope of the present invention.
As shown in fig. 1, an embodiment of the present invention provides a toggle switch state detection circuit, which may include: a first number of toggle switch groups including at least one toggle switch 101, the first number of output ports 102, a second number of detection ports 103, a diode 104 corresponding to each toggle switch 101, and the second number of pull-up resistors 105;
the second quantity is the number of the toggle switches 101 in one toggle switch group, and the number of the toggle switches 101 in any other toggle switch group is not more than the second quantity;
a first end of each pull-up resistor 105 is connected with a first voltage, and a second end of each pull-up resistor 105 is connected to the second number of detection ports 103 in a one-to-one correspondence manner;
the first end of each toggle switch 101 is connected with one detection port 103, and in the same toggle switch group, the detection ports 103 connected with different toggle switches 101 are different;
the anode of each diode 104 is connected to the second end of the corresponding toggle switch 101, and the cathode of each diode 104 is connected to one of the output ports 102;
for any two diodes 104, when the toggle switches 101 respectively corresponding to the two diodes 104 belong to the same toggle switch group, the output ports 102 connected to the two diodes 104 are the same, and when the toggle switches 101 respectively corresponding to the two diodes 104 do not belong to the same toggle switch group, the output ports 102 connected to the two diodes 104 are different;
the on-off state of the line connected with any one of the output ports 102 can be controlled.
The embodiment of the invention provides a toggle switch state detection circuit, which comprises: the circuit comprises a first number of toggle switch groups and output ports, a second number of detection ports and pull-up resistors, and diodes corresponding to the toggle switches. The second quantity is the maximum toggle switch number of the toggle switch group; one end of each pull-up resistor is connected with the first voltage, and the other end of each pull-up resistor is connected with each detection port; one end of each toggle switch is connected with the detection port, and the other end is connected with the anode of the corresponding diode; the detection ports connected with different toggle switches in the same group are different; the cathode of each diode is connected with an output port; when the toggle switches corresponding to the two diodes belong to the same group, the connected output ports are the same, otherwise, the output ports are different; the on-off state of the line connected with any output port can be controlled. And on-off control of the line connected with each output port is based on the level state at each detection port to determine the on-off state of each toggle switch. Therefore, the number of the I/O ports can be reduced.
In detail, a pull-up resistor is arranged in the circuit, so that the current-limiting protection function can be achieved.
In detail, by arranging the diode in the circuit, the problem of mutual voltage crosstalk between every two toggle switches can be prevented in the detection process. In general, crosstalk between voltages affects the state of the 1/O level being detected, and thus the state of the toggle switch being detected. Therefore, the embodiment of the invention can ensure the detection accuracy.
In detail, in the detection circuit, the potential of the cathode of the diode is in the GND state or in the floating state, with the purpose of controlling whether the diode has a preceding condition capable of conducting.
Referring to fig. 1, the toggle switch state detection circuit includes 11 toggle switches, 3 toggle switch groups, 4 pull-up resistors, 4 detection ports, 3 output ports, and 11 diodes. The number of the output ports is equal to the number of groups of the toggle switch group, the number of the diodes is equal to the number of the toggle switches, the number of the detection ports is equal to the number of the pull-up resistors, and the number of the detection ports depends on the maximum number of the toggle switches in the toggle switch group.
Referring to fig. 1, since there are 3 toggle switch sets, the first number is 3. The 3 toggle switch groups are respectively toggle switch group 1 comprising 4 toggle switches from S1 to S4, toggle switch group 2 comprising 4 toggle switches from S5 to S8 and toggle switch group 3 comprising 3 toggle switches from S9 to S11, so the second number is 4.
Referring to fig. 1, the first voltage may be 5V. Of course, in other embodiments of the present invention, the first voltage may also be 3.3V or other voltage values based on different practical application requirements.
Next, a possible toggle switch state detection flow will be described based on the toggle switch state detection circuit shown in fig. 1.
Step 1: the connection of the output port B1 can be controlled to be on, and the connection of the output port B2 can be controlled to be off, and the connection of the output port B3 can be controlled to be off.
Step 2: the switch states of the 4 toggle switches S1-S4 can be detected based on the output port B1 and the 4 detection ports. Specifically, based on the specific connection shown in fig. 1, the switching state of S1 is reflected by a1, the switching state of S2 is reflected by a2, the switching state of S3 is reflected by A3, and the switching state of S4 is reflected by a 4.
Based on the same implementation manner as the above step 1 and step 2, the following steps 3 to 6 can be executed to further determine the switch states of other toggle switches.
And step 3: the connection of the output port B2 can be controlled to be on, and the connection of the output port B1 can be controlled to be off, and the connection of the output port B3 can be controlled to be off.
And 4, step 4: the switch states of the 4 toggle switches S5-S8 can be detected based on the output port B2 and the 4 detection ports. Specifically, based on the specific connection shown in fig. 1, the switching state of S5 is reflected by a1, the switching state of S6 is reflected by a2, the switching state of S7 is reflected by A3, and the switching state of S8 is reflected by a 4.
And 5: the connection of the output port B3 can be controlled to be on, and the connection of the output port B1 can be controlled to be off, and the connection of the output port B2 can be controlled to be off.
Step 6: the switch states of the 3 toggle switches S9-S11 can be detected based on the output port B3 and the 3 detection ports. Specifically, based on the specific connection shown in fig. 1, the switching state of S9 is reflected by a1, the switching state of S10 is reflected by a2, and the switching state of S11 is reflected by A3.
From the above steps 1 to 6, it can be known that the detection of the state of each group of toggle switches can be realized by regularly controlling the output ports, and finally, the detection of the states of all the toggle switches can be realized.
In summary, based on the toggle switch state detection circuit, the switch state of each toggle switch can be detected. Correspondingly, in order to realize detection, 4 detection ports and 3 output ports need to be arranged on the circuit board, namely 7 ports need to be arranged. When the existing implementation mode is adopted, 11I/O ports need to be arranged on the circuit board so as to respectively detect the 11 toggle switches. By contrast, the embodiment of the invention can reduce the setting number of the I/O ports. Cost savings may be achieved due to the reduction in hardware requirements for the I/O ports.
From the above step 6, since there is no toggle switch connected to a4 in the toggle switch group 3, it is not necessary to pay attention to a 4. Therefore, the number of the toggle switches in different toggle switch groups can be equal, so as to utilize each detection port to the maximum extent.
Based on this, in an embodiment of the present invention, the number of the toggle switches 101 in any one of the toggle switch sets is the second number. That is, the numbers of the toggle switches in different toggle switch groups are equal, so that all the toggle switches can be distributed in a matrix form theoretically, the number of rows of the matrix is the second number, and the number of columns of the matrix is the first number. Referring to fig. 2, the toggle switch state detection circuit shown in fig. 2 includes 16 toggle switches distributed in a matrix of 4 rows and 4 columns.
In the embodiment of the invention, for the detection of the matrix type toggle switch, the number of the ports is the sum of the first number and the second number. In the conventional implementation, the port setting number is a product of the first number and the second number. It can be seen that the number of ports required to be provided in the embodiment of the present invention is reduced, and the larger the first number and the second number are, the more significant the advantage is.
In detail, the matrix type toggle switch state detection circuit can realize the quick detection of the toggle switch state, and is applicable to the electronic circuit industry, in particular to the field of single-chip microcomputers.
Based on the above, to realize the state detection of the toggle switch, the on-off state of the line connected to the output port should be controllable. In the embodiment of the present invention, at least the following two implementation manners may exist to support control of the on-off state of the line connected to the output port.
Mode A: when the original N-channel drain open-circuit output does not exist in the circuit, an NMOS transistor is arranged, and the control of the on-off state of a circuit connected with an output port is supported through the NMOS transistor connected with the output port;
mode B: when the original N-channel open-drain output exists in the circuit, the output port is configured to be the N-channel open-drain output, so that the on-off state of a line connected with the output port is controlled.
In detail, based on the above mode a:
in an embodiment of the present invention, referring to fig. 2, the toggle switch state detection circuit further includes: an NMOS transistor 201 corresponding to each of the output ports 102;
wherein the source of each NMOS transistor 201 is grounded;
the grid electrode of each NMOS transistor 201 is connected with a corresponding output circuit;
the cathode of each diode 104 is connected to the drain of an NMOS transistor 201 to connect to the output port 102 corresponding to the NMOS transistor 201.
In the embodiment of the invention, for any output port, the output port can be controlled to output the first voltage so as to enable the NMOS transistor corresponding to the output port to be conducted; and the output port can be controlled to output zero level, so that the NMOS transistor corresponding to the output port is not conducted.
Specifically, when the NMOS transistor corresponding to the output port is turned on, that is, the line connected to the output port is turned on, and when the NMOS transistor corresponding to the output port is turned off, that is, the line connected to the output port is turned off.
In detail, based on the above mode B:
in one embodiment of the present invention, the output port 102 is configured as an open-drain output with N-channel.
In the embodiment of the invention, for any output port, the N-channel open-drain output port can be set to be in a 0 level state, so that a line connected with the N-channel open-drain output port is conducted; and the N-channel open drain output port can be set to be in an open state, so that the circuit connected with the N-channel open drain output port is disconnected.
Based on the above, preferably, in an embodiment of the present invention, referring to fig. 2, the toggle switch state detection circuit may further include: a filter circuit 202 corresponding to each of the detection ports 103; a first end of each of the filter circuits 202 is connected to the corresponding detection port 103, and a second end of each of the filter circuits 202 is grounded.
In detail, the size of the filter capacitor can be adjusted according to actual conditions.
Based on the above, as shown in fig. 3, an embodiment of the present invention provides a toggle switch state detection method based on any one of the toggle switch state detection circuits, which may include the following steps:
step 301: sequentially aiming at each output port, executing the following steps:
and controlling the connection of the line connected with the current output port to be conducted and controlling the connection of any other output port to be disconnected.
Step 302: aiming at each target toggle switch, the target toggle switch is connected with the toggle switch of the current output port, and all the steps are executed as follows:
and determining the switch state of the current target toggle switch according to the level state at the detection port connected with the current target toggle switch.
In detail, corresponding to the above-described mode a:
in an embodiment of the present invention, the toggle switch state detection circuit includes an NMOS transistor corresponding to each of the output ports;
the source electrode of each NMOS transistor is grounded;
the grid electrode of each NMOS transistor is connected with a corresponding output circuit;
the cathode of each diode is connected with the drain electrode of an NMOS transistor so as to be connected with the output port corresponding to the NMOS transistor;
the controlling the circuit connected with the current output port to be conducted comprises: controlling the current output port to output the first voltage so as to enable the NMOS transistor corresponding to the current output port to be conducted;
the control of the disconnection of the line connected with any other output port comprises the following steps: and controlling any other output port to output zero level so as to make the NMOS transistor corresponding to any other output port not be conducted.
In detail, corresponding to the above-described mode B:
in one embodiment of the invention, the output port is configured as an N-channel open-drain output;
the controlling the circuit connected with the current output port to be conducted comprises: setting the current N-channel open-drain output port to be in a 0 level state so as to enable a line connected with the current N-channel open-drain output port to be conducted;
the control of the disconnection of the line connected with any other output port comprises the following steps: and setting any other N-channel open-drain output port to be in an open circuit state so as to disconnect the lines connected with any other N-channel open-drain output port.
In an embodiment of the present invention, the determining, according to a level state at a detection port connected to a current target toggle switch, a switch state of the current target toggle switch includes:
reading the level state of a detection port connected with a current target toggle switch;
when the read level state is a high level, determining that the switch state of the current target toggle switch is off;
and when the read level state is a low level, determining that the switch state of the current target toggle switch is closed.
As shown in fig. 4, an embodiment of the present invention provides a toggle switch state detection apparatus based on any one of the toggle switch state detection circuits described above, which may include:
a control unit 401, configured to perform, for each of the output ports in turn: controlling the connection of the line connected with the current output port and the disconnection of the line connected with any other output port;
a detecting unit 402, configured to perform, for each target toggle switch, the following operations, where the target toggle switch is a toggle switch connected to the current output port: and determining the switch state of the current target toggle switch according to the level state at the detection port connected with the current target toggle switch.
Because the information interaction, execution process, and other contents between the units in the device are based on the same concept as the method embodiment of the present invention, specific contents may refer to the description in the method embodiment of the present invention, and are not described herein again.
In summary, the embodiments of the present invention have at least the following advantages:
1. in an embodiment of the present invention, the toggle switch state detection circuit includes: the circuit comprises a first number of toggle switch groups and output ports, a second number of detection ports and pull-up resistors, and diodes corresponding to the toggle switches. The second quantity is the maximum toggle switch number of the toggle switch group; one end of each pull-up resistor is connected with the first voltage, and the other end of each pull-up resistor is connected with each detection port; one end of each toggle switch is connected with the detection port, and the other end is connected with the anode of the corresponding diode; the detection ports connected with different toggle switches in the same group are different; the cathode of each diode is connected with an output port; when the toggle switches corresponding to the two diodes belong to the same group, the connected output ports are the same, otherwise, the output ports are different; the on-off state of the line connected with any output port can be controlled. And on-off control of the line connected with each output port is based on the level state at each detection port to determine the on-off state of each toggle switch. Therefore, the number of the I/O ports can be reduced.
2. In the embodiment of the invention, the hardware requirement of the I/O port is reduced, so the aim of saving cost can be achieved.
3. In the embodiment of the invention, the problem of mutual voltage crosstalk between every two toggle switches can be prevented in the detection process by arranging the diode in the circuit. In general, crosstalk between voltages affects the state of the 1/O level being detected, and thus the state of the toggle switch being detected. Therefore, the embodiment of the invention can ensure the detection accuracy.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising a" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
Those of ordinary skill in the art will understand that: all or part of the steps for realizing the method embodiments can be completed by hardware related to program instructions, the program can be stored in a computer readable storage medium, and the program executes the steps comprising the method embodiments when executed; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
Finally, it is to be noted that: the above description is only a preferred embodiment of the present invention, and is only used to illustrate the technical solutions of the present invention, and not to limit the protection scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.
Claims (10)
1. A toggle switch state detection circuit, comprising:
the circuit comprises a first number of toggle switch groups including at least one toggle switch, a first number of output ports, a second number of detection ports, a diode corresponding to each toggle switch and a second number of pull-up resistors; the number of the detection ports depends on the maximum number of the toggle switches in the toggle switch group;
the second quantity is the number of the toggle switches in one toggle switch group, and the number of the toggle switches in any other toggle switch group is not more than the second quantity;
the first end of each pull-up resistor is connected with a first voltage, and the second end of each pull-up resistor is connected with the detection ports of the second number in a one-to-one correspondence manner;
the first end of each toggle switch is connected with one detection port, and in the same toggle switch group, the detection ports connected with different toggle switches are different;
the anode of each diode is connected with the second end of the corresponding toggle switch, and the cathode of each diode is connected with one output port;
for any two diodes, when the toggle switches respectively corresponding to the two diodes belong to the same toggle switch group, the output ports connected with the two diodes are the same, and when the toggle switches respectively corresponding to the two diodes do not belong to the same toggle switch group, the output ports connected with the two diodes are different;
the on-off state of a line connected with any one output port can be controlled.
2. The toggle switch state detection circuit of claim 1,
further comprising: an N-type metal-oxide-semiconductor NMOS transistor corresponding to each output port;
the source electrode of each NMOS transistor is grounded;
the grid electrode of each NMOS transistor is connected with a corresponding output circuit;
the cathode of each diode is connected with the drain electrode of an NMOS transistor so as to be connected with the output port corresponding to the NMOS transistor.
3. The toggle switch state detection circuit of claim 1,
the output port is configured as an N-channel open-drain output.
4. The toggle switch state detection circuit of claim 1,
further comprising: a filter circuit corresponding to each detection port;
the first end of each filter circuit is connected with the corresponding detection port, and the second end of each filter circuit is grounded.
5. The toggle switch state detection circuit according to any of claims 1-4,
the number of the toggle switches in any toggle switch group is the second number.
6. A toggle switch state detection method based on the toggle switch state detection circuit according to any one of claims 1 to 5, comprising:
sequentially aiming at each output port, executing the following steps:
controlling the connection of the line connected with the current output port and the disconnection of the line connected with any other output port;
aiming at each target toggle switch, the target toggle switch is connected with the toggle switch of the current output port, and all the steps are executed as follows:
and determining the switch state of the current target toggle switch according to the level state at the detection port connected with the current target toggle switch.
7. The toggle switch state detection method of claim 6,
the toggle switch state detection circuit comprises an N-type metal-oxide-semiconductor NMOS transistor corresponding to each output port;
the source electrode of each NMOS transistor is grounded;
the grid electrode of each NMOS transistor is connected with a corresponding output circuit;
the cathode of each diode is connected with the drain electrode of an NMOS transistor so as to be connected with the output port corresponding to the NMOS transistor;
the controlling the circuit connected with the current output port to be conducted comprises: controlling the current output port to output the first voltage so as to enable the NMOS transistor corresponding to the current output port to be conducted;
the control of the disconnection of the line connected with any other output port comprises the following steps: and controlling any other output port to output zero level so as to make the NMOS transistor corresponding to any other output port not be conducted.
8. The toggle switch state detection method of claim 6,
the output port is configured as an N-channel open-drain output;
the controlling the circuit connected with the current output port to be conducted comprises: setting the current N-channel open-drain output port to be in a 0 level state so as to enable a line connected with the current N-channel open-drain output port to be conducted;
the control of the disconnection of the line connected with any other output port comprises the following steps: and setting any other N-channel open-drain output port to be in an open circuit state so as to disconnect the lines connected with any other N-channel open-drain output port.
9. The toggle switch state detection method according to any one of claims 6 to 8,
the determining the switch state of the current target toggle switch according to the level state at the detection port connected with the current target toggle switch includes:
reading the level state of a detection port connected with a current target toggle switch;
when the read level state is a high level, determining that the switch state of the current target toggle switch is off;
and when the read level state is a low level, determining that the switch state of the current target toggle switch is closed.
10. A toggle switch state detection device based on a toggle switch state detection circuit according to any one of claims 1 to 5, comprising:
a control unit, configured to execute, for each of the output ports in turn: controlling the connection of the line connected with the current output port and the disconnection of the line connected with any other output port;
the detection unit is used for aiming at each target toggle switch, and the target toggle switches are connected with the toggle switch of the current output port and all execute the following steps: and determining the switch state of the current target toggle switch according to the level state at the detection port connected with the current target toggle switch.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910247860.8A CN109932647B (en) | 2019-03-29 | 2019-03-29 | Toggle switch state detection circuit, method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910247860.8A CN109932647B (en) | 2019-03-29 | 2019-03-29 | Toggle switch state detection circuit, method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109932647A CN109932647A (en) | 2019-06-25 |
CN109932647B true CN109932647B (en) | 2021-12-28 |
Family
ID=66988652
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910247860.8A Active CN109932647B (en) | 2019-03-29 | 2019-03-29 | Toggle switch state detection circuit, method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109932647B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108983666B (en) * | 2018-07-27 | 2019-11-08 | 青岛海信日立空调系统有限公司 | Control circuit and control method |
CN110716135A (en) * | 2019-10-28 | 2020-01-21 | 中国兵器工业集团第二一四研究所苏州研发中心 | Effective capturing circuit and capturing method for impact type mechanical switch signal |
CN113093000A (en) * | 2021-04-16 | 2021-07-09 | 上海宏英智能科技股份有限公司 | Three-gear knob switch state detection circuit |
CN114814564A (en) * | 2022-04-11 | 2022-07-29 | 广州天加环境控制设备有限公司 | Novel dial switch detection method |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6512390B1 (en) * | 2000-09-28 | 2003-01-28 | United Microelectronics Corp. | Detecting device for a switch matrix |
CN201126467Y (en) * | 2007-10-15 | 2008-10-01 | 艾默生网络能源有限公司 | A switch state detection circuit |
CN101342890A (en) * | 2008-07-18 | 2009-01-14 | 清华大学 | A Combination Switch Based on Local Internet Bus of Automobile Controller |
CN201859203U (en) * | 2010-11-03 | 2011-06-08 | 中航华东光电有限公司 | Key detection circuit of a singlechip or microprocessor with an analog-digital converter |
CN102830348A (en) * | 2012-08-21 | 2012-12-19 | 江苏华德电力科技有限公司 | Bounce testing device for single-coil magnetic-latching relay and test method of bounce testing device |
CN102866351A (en) * | 2012-09-13 | 2013-01-09 | 十堰科纳汽车电器有限公司 | Switch state detection circuit |
CN103455148A (en) * | 2012-05-31 | 2013-12-18 | 展讯通信(上海)有限公司 | Keyboard, key detecting method and mobile device |
CN107219455A (en) * | 2017-05-22 | 2017-09-29 | 中国电子科技集团公司第四十研究所 | A kind of matrix switch relay failure detector and detection method |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108931720A (en) * | 2018-07-12 | 2018-12-04 | 四川虹美智能科技有限公司 | A kind of switch signal detection circuit and detection method |
-
2019
- 2019-03-29 CN CN201910247860.8A patent/CN109932647B/en active Active
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6512390B1 (en) * | 2000-09-28 | 2003-01-28 | United Microelectronics Corp. | Detecting device for a switch matrix |
CN201126467Y (en) * | 2007-10-15 | 2008-10-01 | 艾默生网络能源有限公司 | A switch state detection circuit |
CN101342890A (en) * | 2008-07-18 | 2009-01-14 | 清华大学 | A Combination Switch Based on Local Internet Bus of Automobile Controller |
CN201859203U (en) * | 2010-11-03 | 2011-06-08 | 中航华东光电有限公司 | Key detection circuit of a singlechip or microprocessor with an analog-digital converter |
CN103455148A (en) * | 2012-05-31 | 2013-12-18 | 展讯通信(上海)有限公司 | Keyboard, key detecting method and mobile device |
CN102830348A (en) * | 2012-08-21 | 2012-12-19 | 江苏华德电力科技有限公司 | Bounce testing device for single-coil magnetic-latching relay and test method of bounce testing device |
CN102866351A (en) * | 2012-09-13 | 2013-01-09 | 十堰科纳汽车电器有限公司 | Switch state detection circuit |
CN107219455A (en) * | 2017-05-22 | 2017-09-29 | 中国电子科技集团公司第四十研究所 | A kind of matrix switch relay failure detector and detection method |
Also Published As
Publication number | Publication date |
---|---|
CN109932647A (en) | 2019-06-25 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109932647B (en) | Toggle switch state detection circuit, method and device | |
CN107317572B (en) | Display device and its protection circuit | |
CN107316598B (en) | Hot-plug short circuit control device and method | |
CN110928823A (en) | Level conversion circuit | |
CN105047127A (en) | Shifting register unit, driving method, row scanning driving circuit and display device | |
US10684974B1 (en) | Auto-switching communication interface | |
CN101425031B (en) | Multi-voltage level detection circuit | |
CN105955524A (en) | Touch screen and detection method thereof, and touch display | |
US12342550B2 (en) | Memory array structure | |
CN110350485B (en) | Current protection module, system and method | |
CN109753470A (en) | A control method, micro-control unit and computer storage medium | |
CN112131165A (en) | Methods and systems for integrated circuits | |
CN105353905A (en) | Touch screen bracing wire configuration circuit, display panel and display device | |
CN109545158B (en) | Protection signal generating circuit and protection device | |
CN109684762B (en) | Chip and setting circuit of pin thereof | |
KR102377614B1 (en) | Segmented capacitive sensors and related systems, methods and devices | |
CN107656169B (en) | Display panel, display device and detection method of display panel | |
US10198114B2 (en) | Touch sensing circuit and control method thereof for high resolution fingerprint recognition | |
CN104242901A (en) | Device for achieving input function and output function of single IO port at the same time and implementation method thereof | |
US20190196604A1 (en) | Keyboard control system and computer input system | |
US9360949B2 (en) | Human interface device | |
GB2267164A (en) | IC card input/output control circuit | |
CN114328042A (en) | Mounted hard disk power consumption analog circuit and control method, device and medium thereof | |
CN101853139B (en) | Hard disk interface device | |
US20140239971A1 (en) | Debugging circuit and circuit board using same |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |