PS2 keyboard emulation

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Hi all,

I am trying to generate PS key scancodes with a microcontroller in order to
send a key press and release to a PC. I can find all sorts of documentation
on the web to attach a keyboard to a controller, but I want to do the
opposite: drive the PC from a controller. I wrote some code that generates
the proper scan codes and verified it against a real keyboard. All data is
the same. However, the PC does not see the scan codes. I noted that the PC
can also send codes to the keyboard. I wonder if this is causing the
problem: my controller does not do reception of scancodes, so I can imagine
that the PC thinks no keyboard is attached because it does not respond.

So the big question is: does a keyboard controller *have* to respond to
commands from the PC?


Re: PS2 keyboard emulation
Quoted text here. Click to load it

Ha, I found out that I mirrored the pinout of my PS2 connecter. I even
implemented a wait loop until both CLK and DATA are high, before starting
transmission. I managed to get the computer to read a key make but it did
not see the release scancode. So, still not working ok.


Re: PS2 keyboard emulation
Quoted text here. Click to load it

Maybe your PC sends a RESET command to the "keyboard" on startup and expects
an ACK in response? If it doesn't get an ACK then the PC might choose to
ignore the keyboard from this point on. If your controller does not receive
commands from the PC then it will be difficult to send the ACK in a timely

Re: PS2 keyboard emulation
Hi, all,

Check out the book and source code in Gary Konzak's book PC Keyboard Design.
It is available at Annabooks.  Additional free info available from USAR
KeyCoder data sheets etc.


Quoted text here. Click to load it

Re: PS2 keyboard emulation
i'm not sure this has the information you're looking for, but it seems
like a pretty good resource.

Adam Chapweske's PS/2 protocol/interface pages: /

Rob D. wrote:
Quoted text here. Click to load it

Site Timeline