PS2 keyboard emulation

Jul 02, 2003 4 Replies

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?



Meindert


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.

Meindert

to

documentation

imagine

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 fashion.

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.

Cya, Rob

generates

is

PC

expects

receive

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:

formatting link
Hi, all,

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required