Home > other >  Every day a small hardware knowledge - PS/2 interface
Every day a small hardware knowledge - PS/2 interface

Time:10-03

1, PS/2 interface overview
PS/2 is one of the common interface on the computer earlier, used in devices such as keyboard, mouse,

PS/2 name comes from the 1987 IBM launched the personal computer: a PS/2 series,

PS/2 interface is input device interface, rather than the transmission interface, so the PS2 mouth without the concept of transmission rate, only scan rate, under the Windows environment, the sampling rate of PS/2 mouse default is 60 times per second, the sampling rate for USB mouse 120 times per second, a high sampling rate can improve the movement of the mouse accuracy in theory, a PS/2 interface device does not support hot plug, forcibly charged plug could be burned motherboard,

IBM launched in 1984, IBM AT the keyboard interface standard, the standard defines the key, 84 ~ 101 by 5 feet DIN connectors and two-way serial communication protocol, equipped with eight between a host and the keyboard commands,

Again in 1987, IBM introduced a ps/2 keyboard interface standard, the standard defines the 84 ~ 101 key, still but the 6 foot mini - DIN connectors, support 17 between a host and the keyboard commands,

Has 6-pin connector of the keyboard is called AT the keyboard, with six feet mini DIN connector of the keyboard is called the ps/2 keyboard,
(figure 2)

PS2 through the potential size of the equipment transmission of information to accept a different time,

2, the difference between the mouse and keyboard PS/2 port

The mouse PS/2 interface is green, and the PS/2 keyboard interface is purple, the two can not meet the,
(figure 1)
Because the mouse need to displacement information transmission, and the keyboard is different, in addition, the useful 5 feet din interface keyboard, and mouse not
,
It moves, the mouse will output a set of clock and data signals; While at rest, the clock and data signals will be kept for logic high level, said is idle, each time you move the mouse to host on different information based on PS/2 protocol and the mouse takes the form of relative coordinates to track its movement
And the keyboard does not need to deal with the displacement information, so the agreement is different with the mouse,

Another keyboard PS/2 port physical all key to achieve genuine no rush,

3, PS/2 keyboard design read
1) the electrical connection in the
PS/2 both connector only four feet are meaningful, they respectively are Clock (foot) Clock, Data, Data, + 5 v power (foot) and Ground (power), the PS/2 keyboard and PC's physical connection as long as to ensure the four thread one-to-one correspondence, PS/2 keyboard PS/2 port on PC + 5 v power supply, the other two feet Clock feet (foot) Clock and Data Data are open collector, so you have to pull up resistors of great value, they maintain a high level at ordinary times, have to be pulled to the output of the low level, after automatic
Floating to the high level,
2 key packet structure
Plate of the status of each change, the keyboard will be sent at least three bytes of data packets, when A key press to the host to send the key Code (Make Code), when the key release send Break Code (Break Code), for example: the key of "A" Code of 0 x1c, key Break Code for "A" : 0 xf0, 0 x1c, so when it comes to transfer the keys "A", the keyboard sends packets of the Code is: 0 x1c, 0 xf0, 0 x1c,)

3) data packet parsing
As shown in figure 3
If the number of the data bits of 1 is even parity bit is 1; If 1 with odd number of data bits, the parity bit is 0; In short, the number of data bits in 1 plus parity with odd number 1 in total, so total of odd parity,
Ps2 equipment clock and data are open collector, is a high level at ordinary times, when ps2 equipment are waiting to send data, it first checks the clock is high, if it is low, is that PC inhibits communications, it buffer the data until to gain control of the bus, at this time if the clock is high level, ps2 begin to send data to the PC,
Is usually produced by the ps2 equipment the clock signal, send press frame format, data bits in the clock, ready for high levels falling edge at the clock read by PC,
Data from the keyboard/mouse is sent to the host or sent from the host to the keyboard/mouse and the clock is the PS2 equipment. The host has priority to the clock control, namely the host wants to send control instructions to PS2 equipment, can lower the clock line at least 100 mu S, then the drop-down wires, the last release the clock line is high, the PS2 equipment clock line and data line is open collector, easy to achieve low level,

4 interface timing
PS/2 protocol is a two-way half-duplex serial communication protocol, the Clock signal is produced by the keyboard, Clock frequency for 33 biggest KHZ, the recommended frequency in 15 KHZ, both ends of communication through the Clock synchronization, Data through Data exchange, if either party wants to ban the other communication, just put the Clock to the low level, its transport sequence depending on the direction of the transmission is divided into two different temporal logic, sending and receiving
Sequence diagram as shown in figure 4,
When the keyboard to host communication, keyboard always first checks the clock line is high level, if not indicates is host is communication, must buffer to send data until to regain control of the bus (keyboard has 16 bytes of buffer), that is, until the clock line is high level to send data to and from the keyboard to a host of data can only be read on the falling edge of the clock, when the host and the keyboard for communication, master the opportunity to set the clock line and data line to first "request" status, the specific way is: at least 100 mu s first down the clock line to inhibit communication, then the "request" pull the wires, the last release the clock, in the process, the keyboard in the interval of not more than 10 mu s will check the status, when the keyboard check to the state, started to produce the clock, send is not the same as the way of data read and keyboard, host sends data must be read in the rising clock,

4, PS/2 port EMC electric
路图五 EMC标准电路 图六P主板P中S/2口接TVS管等器件,然后与NCT6796D之类的接口芯片通信
  • Related