Need help PS/2 Keyboard Emulation !!!

Thread Starter


Joined Jun 1, 2006
Hi all,

I am having problems in emulating the keyboard controls. Ihave observed the keyboard data transmission protocol by refering some sites and parallely hooking my CRO probes to the KBD_DATA and KBD_CLK line of my keyboard when transmitting some data. Iam using Atmel's 89C52 MCU. I have checked the timing details and everything is fine but it is not working.

What the MCU will do is send the data corresponding to "a" key to the PC at an interval of 2.5 seconds. before making the MCU to execute i opened a notepad and connected my Keyboard and typed character "a" in the keyboard. Observed the timing details and the data transmission pattern and in a similar way i'd programmed my MCU to send the code. i.e 2 bytes of code. I removed the PC KBD's Data and clk line and connected the same from PC to my MCU . when the probes are hooked to the data and CLK line. i could get the same timing pulses as that sent by the keyboard but the character is not appearing on the notepad. I once again reconnected the PC kbd and it started typing characters, but when the same signal is gven by MCU it is not working. Can some one explain this ?. In some site they have mentioned that the kbd data and clk lines are opencollector. The 89C52's port 0.0,0.1 are also open collector and i've used them but in vain. PLease do help me. the following sites i referred for Knowing about PS/2 Communication.


Joined Oct 14, 2005
If you say everything is fine then obviously it should've worked. There must be something that you miss. I suggest you check again for the protocol, timing and signals. Are you sure the micro output is open collector? Maybe doing a low and high-impedance instead of high is a better bet?

I did a similar thing with a PIC, and the only time it didn't work was when both the keyboard and the PIC was both connected to the PC.