CN107346180A - A kind of PS2 computer keyboard interfaces design based on singlechip technology - Google Patents
A kind of PS2 computer keyboard interfaces design based on singlechip technology Download PDFInfo
- Publication number
- CN107346180A CN107346180A CN201610283350.2A CN201610283350A CN107346180A CN 107346180 A CN107346180 A CN 107346180A CN 201610283350 A CN201610283350 A CN 201610283350A CN 107346180 A CN107346180 A CN 107346180A
- Authority
- CN
- China
- Prior art keywords
- keyboard
- data
- singlechip technology
- present
- design based
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/01—Input arrangements or combined input and output arrangements for interaction between user and computer
- G06F3/02—Input arrangements using manually operated switches, e.g. using keyboards or dials
- G06F3/0202—Constructional details or processes of manufacture of the input device
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/38—Information transfer, e.g. on bus
- G06F13/382—Information transfer, e.g. on bus using universal interface adapter
- G06F13/385—Information transfer, e.g. on bus using universal interface adapter for adaptation of a particular data processing system to different peripheral devices
Abstract
The invention belongs to singlechip technology field, more particularly to a kind of PS2 computer keyboard interfaces design based on singlechip technology, the present invention to propose the matrix keyboard with a kind of AT89C52 chip microcontrollers with standard PS/2 interfaces.The requirement of the high accuracy, high reliability measuring system that are used for some in various adverse circumstances, devise the keyboard special that suitable this system uses, the keyboard hardware circuit is simple, Software for Design has that safe and reliable, fault-tolerant ability is strong, it may be directly applied in the various operating systems using PS2 agreements, and the repertoire of retention criteria keyboard.
Description
Technical field
Patent of the present invention is related to singlechip technology field, more particularly to a kind of PS2 computer keyboard interfaces design based on singlechip technology.
Background technology
In working in the wild, the keyboards of many industry control PCs is in idle state because being influenceed to be unfavorable for the use of keyboard by adverse circumstances, so as to reduce operating efficiency.Therefore need to design that a kind of applicability is wider, and the keyboard of adverse circumstances can be overcome.For single-chip microcomputer because its is cost-effective, disposal ability is strong, and antijamming capability is good, is used widely in all kinds of industrial control systems and equipment and instrument such as medicine equipment, mechanical electronic hydraulic control, data transfer.One side and, in actual applications, the data that single-chip microcomputer is frequently necessary to collect are sent to PC and are handled or preserved;The opposing party and, industrial control system and equipment and instrument design, because of the limitation of environment or software and hardware resources, also tend to need different communication interfaces.Therefore, designing a PS/2 keyboard with versatility had both facilitated PC to carry out peripheral expansion, enriched the interface resource of single-chip microcomputer again.The data communication protocol that single-chip microcomputer is commonly used with PC is RS-232 communication protocols, it is binary system to transmit data format, and the data format that single-chip microcomputer is transmitted by PS/2 keypad protocols is ASCII character, directly it can be handled and be preserved in the form of conventional text and form document.At present, it is data that single-chip microcomputer receives PS/2 keyboard equipments that single-chip microcomputer communicate more using PS/2 agreements, and it is then more rare to be communicated using single-chip microcomputer as keyboard with PC.AT 89C52 are the low-voltages of American ATMEL production, high-performance, piece include 8K can erasable single-chip microcomputer repeatedly, have that peripheral hardware circuit is simple, small volume, reliability is high, the monitor task of keyboard is completed from it, in actual applications, sometimes may accidentally press the button of lower keyboard, equipment or the parameter and state of instrument are changed, makes system operation abnormal.For computer security and false triggering is prevented, it is necessary to by keyboard lockout, also some keys is taken with shielding measure, but PC QWERTY keyboards can not meet these requirements.
Patent of invention content
Patent of the present invention belongs to singlechip technology field, more particularly to a kind of PS2 computer keyboard interfaces design based on singlechip technology, the present invention propose the matrix keyboard with a kind of AT89C52 chip microcontrollers with standard PS/2 interfaces.
The requirement of the high accuracy, high reliability measuring system that are used for some in various adverse circumstances, devise the keyboard special that suitable this system uses, the keyboard hardware circuit is simple, Software for Design has that safe and reliable, fault-tolerant ability is strong, it may be directly applied in the various operating systems using PS2 agreements, and the repertoire of retention criteria keyboard.
Brief description of the drawings
Fig. 1:System principle diagram.
Fig. 2:AT89C52 and PC interface circuit schematic diagram.
Fig. 3:Keyboard forms circuit diagram.
Fig. 4:QWERTY keyboard terminal fitting schematic diagram.
Fig. 5:Data transmission timing figure of the keyboard to PC.
Fig. 6:Data transmission timing figure of the PC to keyboard.
Embodiment
In order that the object, technical solution and advantage of patent of the present invention are more clearly understood, below in conjunction with drawings and Examples, patent of the present invention is further elaborated.It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention patent, is not intended to limit the present invention patent.
Patent of the present invention belongs to singlechip technology field, more particularly to a kind of PS2 computer keyboard interfaces design based on singlechip technology, the present invention propose the matrix keyboard with a kind of AT89C52 chip microcontrollers with standard PS/2 interfaces.
The requirement of the high accuracy, high reliability measuring system that are used for some in various adverse circumstances, devise the keyboard special that suitable this system uses, the keyboard hardware circuit is simple, Software for Design has that safe and reliable, fault-tolerant ability is strong, it may be directly applied in the various operating systems using PS2 agreements, and the repertoire of retention criteria keyboard.
Hardware design
Further, system principle diagram is as shown in Figure 1, according to design requirement, 89C52 single-chip microcomputers are used as core, pass through analog interface hardware design and analog interface Software for Design, the data that the keyboard for alloing to be made by 89C52 is sent are identified by PS/2 agreements by PC, and 89C52 is used in the purpose of PC to reach as keyboard.52 kernels have the characteristics of disposal ability is strong, the speed of service is fast, low in energy consumption.This scheme have efficiency, stably, it is easy the advantages of.
(1)Interface circuit design
Further, the present invention uses the AT89C52 single-chip microcomputers of atmel corp as simulating keyboard, as shown in Figure 2 with the interface circuit of PC.Because the design be keyboard communication module, it is necessary to operation task it is less, can be directly using the P1.0 mouths on single-chip microcomputer as data wire in circuit design, P1.1 mouths are as clock line.The power supply of single-chip microcomputer can be obtained directly from the PS/2 interfaces of PC.
(2)Keyboard designs
Further, keyboard forms circuit as shown in figure 3, keyboard is made up of push-button array and knowledge key, communicating circuit.Button is arranged on ranks line crosspoint, and ranks line is connected respectively to the both ends of key switch.Line is connected on+5V by pull-up resistor.When usually without actuation of keys, line is in high level state, and when there is button to press, line level state will be determined by the alignment level being connected with this line.If alignment is low level, line is low level;If alignment is high level, line is also high level.This is the key whether recognition matrix keyboard is pressed.
(3)QWERTY keyboard operation principle
Further, QWERTY keyboard interface is as shown in figure 4, plug (Plug) is made up of an alignment pin and six roots of sensation metal pins.Each pin definition is power supply (VCC), power ground (GND) respectively, and serial time clock line (CLK) and remaining two pins of serial data line (DATA) retain.PC is by power and ground to PS/2 keyboard offer+5V power supplys.Socket (Socket) supports the use with plug, and the definition of its each pin is similar with plug.QWERTY keyboard (also referred to as equipment or peripheral hardware) can mutually transmit data with PC (also referred to as main frame), using bi-directional synchronization serial protocol.PC has bus control right, can drag down clock line and be sent to suppress or terminate the data of keyboard.Using the serial asynchronous communication data format of standard, the form of data frame is PS/2 communication protocols:1 start bit (being always 0), 8 data bit, 1 bit parity check position (odd), 1 stop position (being always 1) and 1 response bits ACK (ACK exists only in main frame in the communication of equipment).Low level is preceding when data are sent, and a high position is rear.Peripheral hardware often receives 1 frame data that main frame is sent, and the stop position that will follow the frame closely sends response bits ACK (0) response main frame.Then, peripheral hardware will also send out acknowledgement command, represent that peripheral hardware has been completely received the order of main frame.When PC and keyboard are communicated, either PC sends data or keyboard sends data, is all to provide clock pulses by keyboard.PS/2 communication protocols regulation transmission data maximum clock frequency is 33kHz, and the working frequency of most of PS/2 equipment is 10 ~ 20 kHz, recommendation 15kHz.The data that PC is sent are to be read in the rising edge of clock pulses by keyboard, and the data that keyboard is sent are to be read in the trailing edge of clock pulses by PC.PC sends data to keyboard should at least drag down clock line 100us to suppress to communicate, and data wire is dragged down after clock line about 60us is dragged down, and then discharge clock line to apply sending data.If keyboard does not change clock line, PC will maintain this time of state length of about 15ms, so keyboard should detect this PC data sending request state in the time interval no more than 10ms.After this state is detected, keyboard will be sent clock pulses, PC change data wire state in pulses low by corresponding data bag form.After stop position is received, keyboard drags down one clock cycle of data wire to produce response bits ACK to respond PC.If after the 11st clock pulses, PC does not discharge data wire still, then keyboard should continue to provide clock signal until PC release data wire, then thinks that the frame data receive mistake.Keyboard sends data to PC should first detect whether be all high for idle condition, i.e. clock line and data number.If detecting it is idle condition, keyboard can sends data to PC.Keyboard transmission data procedures are similar with PC transmission data procedures, are all to provide clock pulses according to data packet format by keyboard, but keyboard is the change data when impulse line is high level.Fig. 5 is data transmission timing of the keyboard to PC, and Fig. 6 is data transmission timing figure of the PC to keyboard.Briefly explain three kinds of principal states of PS/2 interface bus:Idle condition, clock line and data wire are all high level, and now keyboard and PC can be applied initiating a data transfer, ask it is all this state during PS/2 interface bus major parts;PC application sends state, and clock line is high level, and data wire is low level, and in this state, keyboard should respond in 10ms and receive data;PC forbids communications status, and clock line is low level, and data wire is high level, and PC can prepare Shen in a manner of dragging down clock line to be transmitted clearly data or abandon the data once transmitted.Keyboard and PC are to realize the transmission of information by sending scan code.Scan code is divided into two kinds of make code and short in size, when a key is pressed, just sends make code, just sends short in size during release.Make code is a hexadecimal byte, and short in size is made up of 0xF0 and make code byte.For example when by the space bar of lower keyboard, keyboard sends make code (0x29), during release, keyboard sends short in size (0xF0,0x29) in succession.When by Macintosh, it should scan code is sent according to button order, such as when " shift+q ", it should (0x12) is sent, (0x15), (0xF0,0x12) and (0xF0,0x15).Keyboard generally used now is using second set of scan code, and II yard of scan code and ASC are without relation in logic, so can be designed during programming with forms mode.
Software for Design
(1)Software Development Platform
Further, present procedure makes to show a C language, and is compiled in Keil uVision2.Keil uVision2 are the 51 compatible Single Chip C Language software development systems of series that Keil Software companies of the U.S. produce, developed using the grammer close to traditional C language, compared with compilation, C language functionally, it is structural, readable, maintainable on have obvious advantage, thus it is easy to learn and use, and greatly improves operating efficiency and project development cycle, he can also Eembedded Assembly, it can be embedded in the position of key, program is reached the operating efficiency close to compilation.Keil C51 softwares provide abundant built-in function and powerful Integrated Development debugging acid, full Windows interfaces, enable you just can learn to develop singlechip application programs using keil C51 in a short period of time.
(2)Keyboard scan subprogram
Further, keyboard sends the make code of the button to main frame when there is button to press, and when button discharges, sends short in size.Program must be scanned to keyboard array, when recognizing some button and just pressing, just send the push-to code to main frame;When recognizing certain button and just unclamping, just the key short in size is sent to main frame.
(3)Communicate subprogram
Further, PS/2 keyboard equipments always produce clock signal.If main frame will send data, clock and data wire must be arranged to " request is sent " state by it first, as follows:
(a)Suppress to communicate by pulling down clock line at least 100 microseconds;
(b), using " request is sent ", clock is then discharged by pulling down data wire.Keyboard equipment should will check this state in the interval no more than 10 milliseconds.When keyboard equipment detects this state, it will start to produce clock signal, and lower eight data bit of input of clock pulses mark and a stop position.Main frame change data line only when clock line is low, and data are latched in the rising edge of clock pulses.The contrast during equipment to host communication is occurring in this.After stop position transmission, keyboard equipment will reply the byte received, and exactly data wire is dragged down and produces last clock pulses.
(4)Keyboard reception system initializes
Further, because PS/2 interfaces do not support hot plug, and start needs the self-test by PC.If connecting keyboard again after PC has been switched on, due to being not detected by keyboard during PC self-test, just will be considered that does not have keyboard peripheral hardware, so at this time keyboard can not use.The key step of PC initialization keyboard includes:
(A)Electricity sends self-test by ordering (0xAA) first on keyboard;
(B)PC sends Reset Status indicator lamp order (0xED);
(C)PC, which is sent, closes all indicator lamp orders (0x00);
(D)PC, which is sent, reads equipment D orders (0xF2);
(E)PC sends Reset Status indicator lamp order (0xED);
(F)PC, which is sent, opens all indicator lamp orders (0x02);
(G)PC sends setting machine and beats rate command (0xF3).
The preferred embodiment of patent of the present invention is the foregoing is only, patent, all any modification, equivalent and improvement made within the spirit and principle of patent of the present invention etc. is not intended to limit the invention, should be included within the protection domain of patent of the present invention.
Claims (4)
1. patent of the present invention belongs to technical field of temperature control, a kind of more particularly to PS2 computer keyboard interfaces design based on singlechip technology, patent of the present invention belongs to singlechip technology field, a kind of more particularly to PS2 computer keyboard interfaces design based on singlechip technology, the present invention proposes the matrix keyboard with a kind of AT89C52 chip microcontrollers with standard PS/2 interfaces, with the characteristics of simple, practical.
A kind of 2. PS2 computer keyboard interfaces design based on singlechip technology according to claim 1, it is characterized in that, the present invention uses 89C52 single-chip microcomputers as core, pass through analog interface hardware design and analog interface Software for Design, the data that the keyboard for alloing to be made by 89C52 is sent are identified by PS/2 agreements by PC, and 89C52 is used in the purpose of PC to reach as keyboard.
3. a kind of PS2 computer keyboard interfaces design based on singlechip technology according to claim 1, it is characterised in that the present invention is using the AT89C52 single-chip microcomputers of atmel corp as simulating keyboard.
4. a kind of PS2 computer keyboard interfaces design based on singlechip technology according to claim 1, it is characterised in that present procedure makes to show a C language, and is compiled in Keil uVision2.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610283350.2A CN107346180A (en) | 2016-05-04 | 2016-05-04 | A kind of PS2 computer keyboard interfaces design based on singlechip technology |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610283350.2A CN107346180A (en) | 2016-05-04 | 2016-05-04 | A kind of PS2 computer keyboard interfaces design based on singlechip technology |
Publications (1)
Publication Number | Publication Date |
---|---|
CN107346180A true CN107346180A (en) | 2017-11-14 |
Family
ID=60252786
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610283350.2A Pending CN107346180A (en) | 2016-05-04 | 2016-05-04 | A kind of PS2 computer keyboard interfaces design based on singlechip technology |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107346180A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109189242A (en) * | 2018-09-30 | 2019-01-11 | 天津市英贝特航天科技有限公司 | A kind of key board unit and working method based on PS2 agreement |
CN110213013A (en) * | 2018-02-28 | 2019-09-06 | 中航光电科技股份有限公司 | A kind of telecommunication system and method based on PS/2 interface |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103744520A (en) * | 2013-12-26 | 2014-04-23 | 天维讯达无线电设备检测(北京)有限责任公司 | Instrument special keyboard based on single-chip microcomputer and working method thereof |
CN205193738U (en) * | 2015-11-27 | 2016-04-27 | 山东超越数控电子有限公司 | Support PS2 and USB double nip keyboard of special function key |
-
2016
- 2016-05-04 CN CN201610283350.2A patent/CN107346180A/en active Pending
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103744520A (en) * | 2013-12-26 | 2014-04-23 | 天维讯达无线电设备检测(北京)有限责任公司 | Instrument special keyboard based on single-chip microcomputer and working method thereof |
CN205193738U (en) * | 2015-11-27 | 2016-04-27 | 山东超越数控电子有限公司 | Support PS2 and USB double nip keyboard of special function key |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110213013A (en) * | 2018-02-28 | 2019-09-06 | 中航光电科技股份有限公司 | A kind of telecommunication system and method based on PS/2 interface |
CN109189242A (en) * | 2018-09-30 | 2019-01-11 | 天津市英贝特航天科技有限公司 | A kind of key board unit and working method based on PS2 agreement |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103136138B (en) | Chip, chip debugging method and communication method for chip and external devices | |
CN104503594A (en) | PS/2 keyboard-mouse remote switching system | |
CN101901058B (en) | Wireless keyboard and mouse receiving and transmitting device | |
CN102508659A (en) | Method for realizing hot plug on PCI EXPRESS (peripheral component interconnect express) in Linux | |
CN107346180A (en) | A kind of PS2 computer keyboard interfaces design based on singlechip technology | |
US10838510B2 (en) | Generating modified keyboard data received from a client device to reduce unintended key repetition | |
CN110968352A (en) | PCIE equipment resetting system and server system | |
CN104375916A (en) | Method and device for directly achieving computer hardware diagnosis through USB interface | |
CN200941202Y (en) | Apparatus for contactless ICC connectivity | |
CN103207850A (en) | External device and transmission system and transmission method of different type device | |
CN106406154B (en) | debugging system and control method thereof | |
CN106294252B (en) | Ultrahigh speed chip interconnection means and its connection control method | |
CN110943888B (en) | Convenient full-function serial port detection method and device | |
CN104123257A (en) | Universal serial bus devices, communication method, and computer readable storage medium | |
CN108388481B (en) | Intelligent watchdog circuit system of OLT equipment | |
CN115344105A (en) | Chip with multiplexed interfaces and debugging system of chip | |
CN207249662U (en) | Adaptive usb synchronizers | |
CN105740192A (en) | PS2 interface keyboard/mouse hot plug system and realization method thereof | |
CN203217562U (en) | External equipment and heterogeneous equipment transmission system | |
CN205229976U (en) | KVM system of compatible multiple mouse type | |
CN104252430A (en) | State indicating method and electronic equipment | |
CN107102612A (en) | A kind of logic control element | |
CN109684885A (en) | A method of detection snaps into | |
CN116527552A (en) | White box switch test instruction processing method, system, terminal and storage medium | |
CN102929644B (en) | A kind of embedded operating control device for computer hardware experiment microprocessor |
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 | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20171114 |
|
WD01 | Invention patent application deemed withdrawn after publication |