Keyboard compatible with PS2 and USB and control method thereof
By introducing a communication selection module and a master MCU into the keyboard, the PS2 and USB communication protocols are compatible, which solves the problem that existing keyboards cannot support multiple communication protocols at the same time, and improves the application range and flexibility of the keyboard.
Patent Information
- Application Number
- CN202411606341.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-12
- Publication Date
- 2025-04-25
AI Technical Summary
Existing industrial computer keyboards cannot support both PS2 and USB communication protocols, and the physical interface is incompatible, which limits its application scope.
A PS2 and USB compatible keyboard is designed, which includes a row and column scanning circuit, a master MCU and a communication selection module. The communication selection module sends a high level or low level signal, the main control MCU judges and selects the corresponding communication protocol, and converts the key information into the corresponding communication signal.
It realizes the compatibility of the keyboard for PS2 and USB communication, and is suitable for computers using PS2 or USB communication, solves the problem of physical interface incompatibility and improves the application flexibility of the keyboard.
Smart Images

Figure CN119883977A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of industrial computer keyboard peripherals, and in particular relates to a keyboard compatible with PS2 and USB and a control method thereof. Background Art
[0002] The keyboard is an important peripheral of the computer, which has the function of character input. The commonly used communication methods are USB communication or PS2 communication. Currently, the keyboards of industrial computers (hereinafter referred to as computers) on the market have the following problems:
[0003] 1. The keyboard has a single external communication protocol and cannot support both PS2 and USB protocols;
[0004] Second, the external connectors of keyboards using the USB communication protocol and keyboards using the PS2 communication protocol have different shapes, that is, the physical interfaces of USB keyboards and PS2 keyboards are incompatible;
[0005] 3. Most keyboards on the market use dedicated chips that only support the sending of separate PS2 signals or separate USB signals, and do not have the expansion of additional functions, that is, they cannot send PS2 signals and USB signals at the same time.
[0006] Currently, since computer keyboards only support a single communication protocol, users must select a corresponding keyboard according to the communication protocol used by the computer, which causes inconvenience in actual use. Summary of the invention
[0007] In view of this, the present invention provides a PS2 and USB compatible keyboard and a control method thereof, the keyboard can achieve compatibility of PS2 communication and USB communication, and is suitable for computers using PS2 communication and computers using USB communication.
[0008] The present invention is achieved through the following technical solutions:
[0009] A keyboard compatible with PS2 and USB, comprising: a keyboard body and a connector;
[0010] The connector has four pins A, namely: a positive power pin, a ground pin and two communication pins;
[0011] The keyboard body includes: a row and column scanning circuit, a main control MCU and a communication selection module;
[0012] The row and column scanning circuit is used to obtain the key information of the keyboard;
[0013] The communication selection module is used to send a high level signal or a low level signal to the main control MCU to trigger the USB communication protocol or the PS2 communication protocol;
[0014] The main control MCU is electrically connected to the row and column scanning circuit for transmitting key information;
[0015] The main control MCU is electrically connected to the connector. The main control MCU is provided with a USB communication protocol and a PS2 communication protocol. The main control MCU triggers the corresponding communication protocol according to the level signal received from the communication selection module. The key information is converted into a communication signal corresponding to the communication protocol according to the communication protocol; the converted communication signal is transmitted to the computer through the connector.
[0016] Further, when the communication selection module triggers the USB communication protocol in the main control MCU, pin a of the connector provides a power supply voltage, pin b serves as the positive electrode of the data line, pin c serves as the negative electrode of the data line, and pin d is used for grounding;
[0017] When the communication selection module triggers the PS2 communication protocol in the main control MCU, pin a of the connector provides a power supply voltage, pin b serves as a data line, pin c serves as a clock line, and pin d is used for grounding.
[0018] Further, the communication selection module includes: three pins C and a jumper cap;
[0019] The three pins C are respectively: a high level pin, a level signal input pin and a low level pin; the communication selection module is electrically connected to the MCU via the level signal input pin;
[0020] When the jumper cap is connected to the high-level pin and the level signal input pin, the communication selection module generates a high-level signal, triggering the main control MCU to select the USB communication protocol, the keyboard uses the USB communication mode, and the key information is converted into a USB communication signal and transmitted to the computer; when the jumper cap is connected to the low-level pin and the level signal input pin, the communication selection module generates a low-level signal, triggering the main control MCU to select the PS2 communication protocol, the keyboard uses the PS2 communication mode, and the key information is converted into a PS2 communication signal and transmitted to the computer.
[0021] Furthermore, the main control MCU includes: a signal conversion module and a character encoding and decoding module;
[0022] The key information is decoded by a character encoding and decoding module;
[0023] The decoded key information is converted by the signal conversion module and transmitted to the computer through the connector.
[0024] Furthermore, it is characterized in that the keyboard body further comprises: a dimming keyboard circuit;
[0025] The dimming keyboard circuit is electrically connected to the main control MCU and is used to adjust the intensity of the backlight of the keyboard.
[0026] A control method for a PS2- and USB-compatible keyboard, based on the above-mentioned PS2- and USB-compatible keyboard, the control method comprises the following steps:
[0027] S1: Initialization of the main control MCU1;
[0028] S2: Select the communication protocol;
[0029] When USB is needed, the communication selection module sends a high-level signal to the main control MCU; when the main control MCU receives the high-level signal, the USB communication protocol is selected;
[0030] When USB is needed, the communication selection module sends a low-level signal to the main control MCU; when the main control MCU receives the low-level signal, the PS2 communication protocol is selected;
[0031] S3: Start the main control MCU;
[0032] S4: receiving keyboard key information;
[0033] S5: key information conversion;
[0034] S6: The converted key information is transmitted to the computer.
[0035] Further, in step S5, when the main control MCU selects the USB communication protocol, the decoded key information is converted into a USB communication signal through the USB communication protocol; when the main control MCU selects the PS2 communication protocol, the decoded key information is converted into a PS2 communication signal through the PS2 communication protocol.
[0036] Beneficial effects:
[0037] (1) A keyboard compatible with PS2 and USB of the present invention has a USB communication protocol and a PS2 communication protocol on the main control MCU, a communication selection module sends a high level signal or a low level signal, the main control MCU judges and selects a communication protocol through the level signal, key information is converted into a communication signal corresponding to the communication protocol according to the communication protocol, and the converted communication signal is transmitted to the computer through a connector, so that the keyboard is compatible with PS2 communication and USB communication, and is suitable for computers using PS2 communication and computers using USB communication, thus solving the compatibility problem between PS2 and USB; meanwhile, the connector of the keyboard is an industrial connector, including four pins A, which can be suitable for both USB communication and PS2 communication, thus solving the problem of incompatibility between the physical interfaces of USB keyboards and PS2 keyboards.
[0038] (2) A keyboard compatible with PS2 and USB of the present invention, when the communication selection module triggers the USB communication protocol in the main control MCU, pin a provides power supply voltage, pin b serves as the positive pole of the data line, pin c serves as the negative pole of the data line, and pin d is used for grounding; when the communication selection module triggers PS2 communication in the main control MCU, pin a provides power supply voltage, pin b serves as the data line, pin c serves as the clock line, and pin d is used for grounding, and the pins on the connector correspond to the four pins required by the PS2 communication connector or the four pins required by the USB communication, thereby achieving physical interface compatibility between the PS2 communication connector and the USB communication connector.
[0039] (3) A keyboard compatible with PS2 and USB of the present invention, when the jumper cap connects the high level pin and the level signal input pin, the communication selection module generates a high level signal, thereby triggering the MCU to select the USB communication protocol, so that the keyboard is in USB communication mode; when the jumper cap connects the low level pin and the level signal input pin, the communication selection module generates a low level signal, thereby triggering the MCU to select the PS2 communication protocol, so that the keyboard is in PS2 communication mode; the jumper cap can quickly switch the circuit connection, which facilitates the switching between PS2 communication and USB communication and generates corresponding communication signals.
[0040] (4) In the PS2 and USB compatible keyboard of the present invention, the dimming keyboard circuit is electrically connected to the main control MCU, so that the keyboard can adjust the intensity of the backlight, making the keyboard more comfortable to use.
[0041] (5) The control method of a PS2- and USB-compatible keyboard of the present invention can trigger a communication protocol adapted to the keyboard according to a high-level signal and a low-level signal, thereby making the keyboard compatible with PS2 communication and USB communication, so that the keyboard can be applied to computers using PS2 communication and computers using USB communication. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 is a structural diagram of the present invention;
[0043] Among them, 1 is the main control MCU, 101 is the signal conversion module, 102 is the character encoding and decoding module, 2 is the connector, 3 is the row and column scanning circuit, 4 is the communication selection module, and 5 is the dimming keyboard circuit. DETAILED DESCRIPTION
[0044] The present invention is described in detail below with reference to the accompanying drawings and embodiments.
[0045] Embodiment 1:
[0046] This embodiment provides a keyboard compatible with PS2 and USB, that is, the keyboard is compatible with USB communication and PS2 communication. The keyboard comprises: a keyboard body and a connector 2.
[0047] The connector 2 is electrically connected to the keyboard body, and the keyboard is connected to the computer through the connector 2. The connector 2 is an industrial connector, and the connector 2 is provided with four pins A, which are respectively: a positive power pin (hereinafter described as pin a), a ground pin (i.e. GND, hereinafter described as pin d) and two communication pins (hereinafter described as pin b and pin c, respectively). When the keyboard selects USB communication, pin a provides a power supply voltage (such as +5V), pin b serves as the positive pole (D+) of the data line, pin c serves as the negative pole (D-) of the data line, and pin d is used for grounding (GND); when the keyboard selects PS2 communication, pin a provides a power supply voltage (such as +5V), pin b serves as the data line (Data), pin c serves as the clock line (Clock), and pin d is used for grounding (GND).
[0048] The keyboard body is electrically connected to the computer via a connector 2. In this embodiment, the connector 2 is a J14A-9ZJB connector, and the definition of the J14A-9ZJB connector is as shown in Table 1 (wherein pin a corresponds to pin 2, pin b corresponds to pin 4, pin c corresponds to pin 8, and pin d corresponds to pin 6).
[0049] Table 1J14A-9ZJB connector definition
[0050] Pin Number USB Definition PS2 Definition 2 +5V +5V 8 D- Clock 4 D+ Data 6 GND GND
[0051] like Figure 1 As shown, the keyboard body includes: a row and column scanning circuit 3, a main control MCU1 (microcontroller unit), a communication selection module 4 and a dimming keyboard circuit 5.
[0052] The row-column scanning circuit 3 is used to obtain the key information of the keyboard.
[0053] The communication selection module 4 is used to send a high level signal or a low level signal to the main control MCU1 to trigger the USB communication protocol or the PS2 communication protocol. The communication selection module 4 includes: a jumper cap and three pins C. The three pins C are respectively: a high level pin (i.e., used to output a high level signal), a level signal input pin and a low level pin (i.e., used to output a low level signal). The communication selection module 4 is electrically connected to the main control MCU1 through the level signal input pin. The level signal input pin is electrically connected to the high level pin or the low level pin through a jumper cap. When the jumper cap connects the high level pin and the level signal input pin, the keyboard is in USB communication mode, and the communication selection module 4 generates a high level signal; when the jumper cap connects the low level pin and the level signal input pin, the keyboard is in PS2 communication mode, and the communication selection module 4 generates a low level signal. The generated high level signal or low level signal is transmitted to the main control MCU1 through the level signal input pin.
[0054] The main control MCU1 is electrically connected to the connector 2, the row and column scanning circuit 3 and the communication selection module 4 through different pins B respectively. The level signal (high level or low level) sent by the communication selection module 4 is transmitted to the main control MCU1 through the corresponding pin B, and triggers the main control MCU1 to judge and select the USB communication protocol or the PS2 communication protocol. The key information obtained by the row and column scanning circuit 3 is transmitted to the MCU1 through the corresponding pin B, and the MCU1 decodes and converts the received key information (i.e., converts it into a corresponding communication signal according to the selected communication protocol), and the converted data is transmitted to the computer through the connector 2.
[0055] Specifically, the main control MCU1 is provided with a judgment module, a USB communication protocol and a PS2 communication protocol. The main control MCU1 includes: a signal conversion module 101 and a character encoding and decoding module 102. The judgment module is used to judge whether the level signal received by the main control MCU1 is a high level or a low level; when the main control MCU1 receives the level signal, the judgment module judges and selects the communication protocol. (After judging the communication protocol, the keyboard maintains the communication mode until reinitialization). The key information received by the main control MCU1 is decoded by the character encoding and decoding module 102, and the decoded key information is sent to the signal conversion module 101. The signal conversion module 101 converts the decoded key information into a corresponding communication signal, and then transmits the communication signal to the computer through the connector 2.
[0056] The dimming keyboard circuit 5 is electrically connected to the main control MCU1. The dimming signal emitted by the dimming keyboard circuit 5 is transmitted to the character encoding and decoding module 102 of the main control MCU1 through the corresponding pin B on the main control MCU1 for decoding, and then converted into a corresponding communication signal through the signal conversion module 101, and then the signal is transmitted to the computer through the connector 2, so as to realize keyboard dimming. In this embodiment, the dimming keyboard circuit 5 is a 64-level dimming keyboard circuit, which can adjust the intensity of the keyboard backlight through 64 different brightness levels.
[0057] Working principle:
[0058] The keyboard in this embodiment is compatible with the connector 2, communication protocols and communication signals of PS2 communication and USB communication.
[0059] (1) Compatibility of physical interfaces:
[0060] Since USB communication and PS2 communication can meet the following requirements: the number of pins of the two communication signals is the same, the working characteristics of the two communication signals are the same (both are two power pins and two communication pins), and the signal sent by the main control MCU1 satisfies the electrical characteristics of the two signals at the same time, therefore, the keyboard can achieve compatibility with connector 2, that is, the one computer keyboard adopts one connector 2 and is suitable for both USB communication and PS2 communication.
[0061] (2) Communication protocol compatibility:
[0062] The main control MCU1 is applicable to two communication protocols and can generate two different communication signals.
[0063] (3) Communication signal compatibility:
[0064] The judging module judges and selects the corresponding communication protocol according to the received level signal, and converts the received information into the corresponding communication signal according to the communication protocol, so as to realize the signal transmission between the computer and the keyboard.
[0065] Embodiment 2:
[0066] This embodiment discloses a control method compatible with PS2 and USB, and the control method is based on the keyboard in Embodiment 1.
[0067] The control method comprises the following steps:
[0068] S1, master MCU1 initialization
[0069] At this time, the main control MCU1 sets the functions of all pins B according to the predetermined pin definitions.
[0070] S2. Select the communication protocol
[0071] Specifically, when USB is needed, the jumper cap is controlled to connect the high level pin and the level signal input pin, so that the main control MCU1 receives a high level signal; when the main control MCU1 receives the high level signal, the USB communication protocol is selected;
[0072] When USB is needed, the jumper cap is controlled to connect the low-level pin and the level signal input pin, so that the main control MCU1 receives the low-level signal; when the main control MCU1 receives the low-level signal, the PS2 communication protocol is selected;
[0073] The communication mode determined at this time continues until the next initialization of the master control MCU1.
[0074] S3, start the main control MCU1
[0075] S4. Receive keyboard key information
[0076] The key information of the keyboard obtained by the row and column scanning circuit 3 is transmitted to the main control MCU 1 through the corresponding pin B on the main control MCU 1 and decoded by the character encoding and decoding module 102 .
[0077] S5. Key information conversion
[0078] The decoded key information is converted into corresponding communication signals through the communication protocol; that is, when the main control MCU1 selects the USB communication protocol, the signal conversion module 101 converts the decoded key information into USB communication signals through the USB communication protocol; when the main control MCU1 selects the PS2 communication protocol, the signal conversion module 101 converts the decoded key information into PS2 communication signals through the PS2 communication protocol.
[0079] S6. Transmit the converted key information
[0080] The converted case information is transmitted to the computer through connector 2, thereby realizing the connection between the computer and the keyboard.
[0081] The keyboard in Example 1 can select different communication modes through the control method and is compatible with industrial computers using USB communication or PS2 communication.
[0082] In summary, the above are only preferred embodiments of the present invention and are not intended to limit the protection scope of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A keyboard compatible with PS2 and USB, characterized in that: include: Keyboard body and connector (2); The connector (2) has four pins A, namely: a positive power pin, a ground pin and two communication pins; The keyboard body comprises: a row and column scanning circuit (3), a main control MCU (1) and a communication selection module (4); The row and column scanning circuit (3) is used to obtain key information of the keyboard; The communication selection module (4) is used to send a high level signal or a low level signal to the main control MCU (1) to trigger the USB communication protocol or the PS2 communication protocol; The main control MCU (1) is electrically connected to the row and column scanning circuit (3) for transmitting key information; The main control MCU (1) is electrically connected to the connector (2); the main control MCU (1) is provided with a USB communication protocol and a PS2 communication protocol; the main control MCU (1) triggers the corresponding communication protocol according to the level signal received from the communication selection module (4); key information is converted into a communication signal corresponding to the communication protocol according to the communication protocol; and the converted communication signal is transmitted to the computer through the connector (2).
2. A PS2 and USB compatible keyboard as claimed in claim 1, characterized in that: When the communication selection module (4) triggers the USB communication protocol in the main control MCU (1), the pin a of the connector (2) provides a power supply voltage, the pin b serves as the positive electrode of the data line, the pin c serves as the negative electrode of the data line, and the pin d is used for grounding; When the communication selection module (4) triggers the PS2 communication protocol in the main control MCU (1), pin a of the connector (2) provides a power supply voltage, pin b serves as a data line, pin c serves as a clock line, and pin d serves as grounding.
3. A PS2 and USB compatible keyboard as claimed in claim 1, characterized in that: The communication selection module (4) comprises: three pins C and a jumper cap; The three pins C are respectively: a high level pin, a level signal input pin and a low level pin; the communication selection module (4) is electrically connected to the MCU via the level signal input pin; When the jumper cap is connected to the high-level pin and the level signal input pin, the communication selection module (4) generates a high-level signal, triggering the main control MCU (1) to select the USB communication protocol, the keyboard is in the USB communication mode, and the key information is converted into a USB communication signal and transmitted to the computer; when the jumper cap is connected to the low-level pin and the level signal input pin, the communication selection module (4) generates a low-level signal, triggering the main control MCU (1) to select the PS2 communication protocol, the keyboard is in the PS2 communication mode, and the key information is converted into a PS2 communication signal and transmitted to the computer.
4. A PS2 and USB compatible keyboard as claimed in claim 1, characterized in that: The main control MCU (1) comprises: a signal conversion module (101) and a character encoding and decoding module (102); The key information is decoded by a character encoding and decoding module (102); The decoded key information is converted by the signal conversion module (101) and then transmitted to the computer through the connector.
5. A PS2 and USB compatible keyboard as described in any one of claims 1 to 4, characterized in that: The keyboard body further comprises: a dimming keyboard circuit (5); The dimming keyboard circuit (5) is electrically connected to the main control MCU (1) and is used to adjust the intensity of the backlight of the keyboard.
6. A control method for a keyboard compatible with PS2 and USB, based on the keyboard in any one of claims 1 to 5, characterized in that: The control method comprises the following steps: S1: Initialization of the main control MCU1; S2: Select the communication protocol; When USB is required, the communication selection module (4) sends a high-level signal to the main control MCU (1); after the main control MCU (1) receives the high-level signal, the USB communication protocol is selected; When USB is required, the communication selection module (4) sends a low-level signal to the main control MCU (1); after the main control MCU (1) receives the low-level signal, the PS2 communication protocol is selected; S3: Start the main control MCU (1); S4: receiving keyboard key information; S5: key information conversion; S6: The converted key information is transmitted to the computer.
7. A control method for a PS2 and USB compatible keyboard as claimed in claim 6, characterized in that: In step S5, when the main control MCU (1) selects the USB communication protocol, the decoded key information is converted into a USB communication signal through the USB communication protocol; when the main control MCU (1) selects the PS2 communication protocol, the decoded key information is converted into a PS2 communication signal through the PS2 communication protocol.