Normally, the transmission is from the device to the host.
These are single-ended signals driven by open-collector drivers at each end.
The interface has two main signal lines, Data and Clock.
The bidirectional IBM AT and PS/2 keyboard interface is a development of the unidirectional IBM PC keyboard interface, using the same signal lines but adding capability to send data back to the keyboard from the computer this explains the asymmetry.
The channel is slightly asymmetrical: it favors transmission from the input device to the computer, which is the majority case.
)Įach port implements a bidirectional synchronous serial channel. (That is, keyboard drivers are written to use the first port, and mouse drivers are written to use the second port. However, unlike the otherwise similar Apple Desktop Bus connector used by Apple, a given system's keyboard and mouse port may not be interchangeable since the two devices use different sets of commands and the device drivers generally are hard-coded to communicate with each device at the address of the port that is conventionally assigned to that device. The PS/2 platform introduced a second port with the same design as the keyboard port for use to connect a mouse thus the PS/2-style keyboard and mouse interfaces are electrically similar and employ the same communication protocol. The PS/2 keyboard port is electrically and logically identical to the IBM AT keyboard port, differing only in the type of electrical connector used. The PS/2 mouse connector generally replaced the older DE-9 RS-232 "serial mouse" connector, while the PS/2 keyboard connector replaced the larger 5-pin/180° DIN connector used in the IBM PC/AT design. Its name comes from the IBM Personal System/2 series of personal computers, with which it was introduced in 1987. The PS/2 port is a 6-pin mini-DIN connector used for connecting keyboards and mice to a PC compatible computer system. ^ Sometimes, keyboard Clock for splitter cable.^ Sometimes, keyboard Data for splitter cable.^ Keyboard and mouse ports may be combined into a single port which can be used to connect both by splitter cable.
The connection between the microcontroller and the ps/2 keyboard seems straight forward enough but then from the microcontroller to USB is another story.Įdit 3: After a bit more searching I discovered that Microchip released a Technical Brief with quite a complete guide on how to do exactly what I was after! Its TB055 and includes the source code for PIC uC. It seems its a not that easy but doable task to create your interface with the use of a cheap microcontroller. As this was based on the original IBM PS/2 (AT) keyboards and this protocol has been carried though to today.Įdit 2: More info found on the electrical interface needed here. Although all the ' scan codes' that the keyboard sends to the system should still work with modern systems.
As USB devices need to be registered and be able to give data to the OS about what it is when requested by the OS. Why?Įdit: Ok so in some more research, I think I understand the why now. So after trying a basic rewiring it didn't work so there has to be some conversion going on but what? The puzzling thing is going from USB to PS/2 works but going the other way doesn't work. Though USB has a differential DATA +- and ps/2 has a data and clock wire. But I am curious as how would one do it themselves? I have tried just rewiring an old keyboard to a USB cable as they both have 5V and ground and 2 data connections. I am quite aware you can get ready made off the shelf adaptors to connect old ps/2 keyboards to USB.