Multi-point touch and remote control shared detection control method
Technical Field
The invention relates to the field of circuit control, in particular to a multi-point touch and remote control shared detection control method.
Background
In the product of multiple load work of multi-point touch control, comparatively demand to the MCU chip is great, often needs the foot position of extension MCU chip, still can increase the volume of the cost of product simultaneously. If the pin positions of some MCU chips can not be expanded, the functions of the MCU chips are greatly limited.
Disclosure of Invention
The present invention is directed to solve at least one of the technical problems in the prior art, and provides a multi-touch and remote control shared detection control method, which achieves the purpose of saving pins by performing shared processing on a control port and a detection port.
According to a first aspect of the present invention, an embodiment provides a multi-touch and remote control shared detection control method, including:
the touch IC is provided with a data transmission pin SDA, a clock signal pin SCL, a work expression pin INT and a plurality of key input ends;
the touch keys are provided with a plurality of touch keys and are connected with the key input ends through input resistors;
the MCU chip is provided with a first pin, a second pin and a third pin, the data transmission pin SDA is connected with the first pin through a first resistor, the clock signal pin SCL is connected with the second pin through a second resistor, and the work performance pin INT is connected with the third pin through a third resistor; when any touch key is touched, the work expression pin INT is in a low level, and when all the touch keys are not touched, the work expression pin INT is in a high level; the response time of each touch key is longer than 100 ms;
the remote control receiving IC is provided with a remote control signal output pin IR, and the remote control signal output pin IR is connected with the third pin; when the remote control receiving IC does not receive signals, the remote control signal output pin IR is in a high level, when the remote control receiving IC receives the signals, the remote control signal output pin IR is in a low level, and a code segment signal with a communication protocol and a total length of no more than 20ms is sent to the third pin;
further comprising the steps of:
the MCU chip performs microsecond detection on the third pin, and if the third pin is detected to be at a low level, timing is started;
if the third pin changes to be high level within microsecond level, judging that the code segment signal sent by the remote control receiving IC is received;
continuing to receive the code segment signal, and decoding the received code segment signal;
if the low level duration time of the third pin exceeds 100ms, judging that the touch key is touched;
the MCU chip outputs a clock signal with high and low changes to the touch IC through the second pin, and simultaneously outputs an address code to the touch IC through the first pin;
after the touch IC writes the address code, a state code containing the state of the key input end is sent back to the MCU chip through the data transmission pin SDA;
and the MCU chip judges the touched touch key according to the state code.
According to the first aspect of the present invention, an embodiment provides a multi-touch and remote control shared detection control method, which has at least the following beneficial effects: the touch IC and the remote control receiving IC share a third pin to be connected with the MCU chip, the MCU chip identifies the input of two signals according to the difference between the duration of response of the touch key and the duration of a code segment signal sent by the remote control receiving IC, the touch IC and the remote control receiving IC are not influenced by interference, the touch IC is also provided with a data transmission pin SDA and a clock signal pin SCL to be matched, and the identification and data transmission between the touch IC and the MCU chip are realized, so that the specific touched touch key is distinguished, and the purpose of saving the pin position is achieved by carrying out shared processing on a control port and a detection port.
According to some embodiments of the present invention, if the low level duration of the third pin exceeds 20ms, the received code segment signal is cleared, and the low level signal continues to be received.
According to some embodiments of the present invention, if the touch key is touched during the process of receiving the code segment signal, the code segment signal is shielded and responds to the key touch preferentially.
According to some embodiments of the invention, the writing of the address code by the touch IC comprises:
and the touch IC reads the level of the data transmission pin SDA at the falling edge of the clock signal pin SCL, and obtains the address code after continuously writing eight bits.
According to some embodiments of the present invention, the status code includes data codes corresponding to the number of the key input terminals, and the data codes are at a low level when the corresponding touch key is touched and at a high level when the corresponding touch key is not touched.
According to some embodiments of the present invention, when the MCU chip outputs an address code through the first pin, the first pin is an output pin, and the data transmission pin SDA is an input detection pin; and after the MCU chip sends the address code, the first pin is changed from an output pin to an input detection pin, and the data transmission pin SDA is changed from the input detection pin to the output pin.
Drawings
The invention is further described below with reference to the accompanying drawings and examples;
fig. 1 is a circuit diagram used in a multi-touch and remote control common detection control method according to an embodiment of the present invention;
fig. 2 is a flowchart of a multi-touch and remote control shared detection control method according to an embodiment of the present invention.
Detailed Description
Reference will now be made in detail to the present preferred embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like reference numerals refer to like elements throughout.
In the description of the present invention, it should be understood that the orientation or positional relationship referred to in the description of the orientation, such as the upper, lower, front, rear, left, right, etc., is based on the orientation or positional relationship shown in the drawings, and is only for convenience of description and simplification of description, and does not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and thus, should not be construed as limiting the present invention.
In the description of the present invention, the meaning of a plurality of means is one or more, the meaning of a plurality of means is two or more, and larger, smaller, larger, etc. are understood as excluding the number, and larger, smaller, inner, etc. are understood as including the number. If the first and second are described for the purpose of distinguishing technical features, they are not to be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated or implicitly indicating the precedence of the technical features indicated.
In the description of the present invention, unless otherwise explicitly limited, terms such as arrangement, installation, connection and the like should be understood in a broad sense, and those skilled in the art can reasonably determine the specific meanings of the above terms in the present invention in combination with the specific contents of the technical solutions.
Referring to fig. 1 and 2, a multi-touch and remote control shared detection control method according to an embodiment of the present invention includes:
the touch IC is provided with a data transmission pin SDA, a clock signal pin SCL, a work expression pin INT and a plurality of key input ends; specifically, the touch IC in fig. 1 is provided with a total of CIN0 to CIN89 key inputs;
the touch keys are provided with a plurality of touch keys and are connected with the key input ends through input resistors; specifically, 7 touch keys such as ON/OFF, SPEED-, SPEED +, BABY, TIMER, SW-UD, SW-RL and the like are arranged in the keyboard 1;
the MCU chip is provided with a first pin, a second pin and a third pin, the data transmission pin SDA is connected with the first pin through a first resistor R25, the clock signal pin SCL is connected with the second pin through a second resistor R26, and the work performance pin INT is connected with the third pin through a third resistor R27; when any touch key is touched, the work expression pin INT is in a low level, and when all the touch keys are not touched, the work expression pin INT is in a high level; the response time of each touch key is longer than 100 ms;
the remote control receiving IC is provided with a remote control signal output pin IR, and the remote control signal output pin IR is connected with the third pin; when the remote control receiving IC does not receive signals, the remote control signal output pin IR is in a high level, when the remote control receiving IC receives the signals, the remote control signal output pin IR is in a low level, and a code segment signal with a communication protocol and a total length of no more than 20ms is sent to the third pin;
further comprising the steps of:
the MCU chip performs microsecond detection on the third pin, and if the third pin is detected to be at a low level, timing is started;
if the third pin changes to be high level within microsecond level, judging that the code segment signal sent by the remote control receiving IC is received;
continuing to receive the code segment signal, and decoding the received code segment signal;
if the low level duration time of the third pin exceeds 100ms, judging that the touch key is touched;
the MCU chip outputs a clock signal with high and low changes to the touch IC through the second pin, and simultaneously outputs an address code to the touch IC through the first pin;
after the touch IC writes the address code, a state code containing the state of the key input end is sent back to the MCU chip through the data transmission pin SDA;
and the MCU chip judges the touched touch key according to the state code.
According to the first aspect of the invention, a third pin shared by a touch IC and a remote control receiving IC is connected with an MCU chip, the MCU chip identifies the input of two signals according to the difference between the response time of a touch key and the code segment signal sent by the remote control receiving IC, and the touch IC is not influenced by interference, and is also provided with a data transmission pin SDA and a clock signal pin SCL to be matched to realize identification and data transmission with the MCU chip, so that the specific touched touch key is distinguished, and the purpose of saving the pin positions is achieved by carrying out shared processing on a control port and a detection port.
According to some embodiments of the present invention, if the low level duration of the third pin exceeds 20ms, the received code segment signal is cleared, and the low level signal continues to be received.
According to some embodiments of the present invention, if the touch key is touched during the process of receiving the code segment signal, the code segment signal is shielded and responds to the key touch preferentially.
According to some embodiments of the invention, the writing of the address code by the touch IC comprises:
and the touch IC reads the level of the data transmission pin SDA at the falling edge of the clock signal pin SCL, and obtains the address code after continuously writing eight bits.
According to some embodiments of the present invention, the status code includes data codes corresponding to the number of the key input terminals, and the data codes are at a low level when the corresponding touch key is touched and at a high level when the corresponding touch key is not touched.
According to some embodiments of the present invention, when the MCU chip outputs an address code through the first pin, the first pin is an output pin, and the data transmission pin SDA is an input detection pin; and after the MCU chip sends the address code, the first pin is changed from an output pin to an input detection pin, and the data transmission pin SDA is changed from the input detection pin to the output pin.
The embodiments of the present invention have been described in detail with reference to the accompanying drawings, but the present invention is not limited to the above embodiments, and various changes can be made within the knowledge of those skilled in the art without departing from the gist of the present invention.