View Full Version : PS2 keyboard emulator

04-16-2007, 04:55 AM
Hi All,

Seen plenty of threads on this subject but can't find any sample code...
Does anyone have basic code to interface a PIC to a PC?



Mike Green
04-16-2007, 05:47 AM
It ought to be possible to do this (have a Stamp take the place of a PS/2 keyboard), but I've never seen sample code posted.
The issue comes up from time to time, most recently about a Propeller being used in place of a PS/2 keyboard.
If you want sample code for a PIC processor, you will have to search elsewhere since this is a support forum for the Parallax Stamp
and, although some of these are made from PICs, they're not the same thing.

04-16-2007, 06:46 AM
Hi Mike,

I'm sure someone has done it, but thanks for your help anyway.


04-16-2007, 08:53 AM
There is a somewhat usable example on how to send data to a pc using the ps2 port. I have attatched the zip file that contains text documentation and example source code.

I have posted this a few times on this forum but for some reason it doesn't appear when people search for it.

04-16-2007, 03:20 PM
I posted something similar -This may be an option.. a routine which runs on a pc waiting for data on a serial port - when it receives data - it injects the data into the keyboard buffer as if it were typed on the p.c. - i have attached a link to it here ...


the thread is here:

so if you send data from the stamp with 'Serout' to a p.c. running this application it is injected into the keyboard buffer on the p.c. as if it were typed...


'Necessity is the mother of invention'

04-16-2007, 05:26 PM
Thanks Quattro/Harrison,

For your reference, In my search XP also does something similar in allowing external serial devices to emulate keyboard strokes. http://www.microsoft.com/windowsxp/using/accessibility/serialkeys.mspx

I will probably head down this path for a quick and easy solution, the challenge is not many pcs now have serial ports these days...yes I could use a USB to serial converter but it's starting to become a messy solution.

Harrison' suggestion is great, but it misses the keyboard init function that is required by windows XP to recognise that a keyboard is plugged in.

So still looking for the ideal solution, if anyone is interested in working it out would be willing to shed some cash for the solution.

Thanks all.


T&E Engineer
04-16-2007, 09:11 PM
Take a look at this post. It has been done on a BS2 to a PS2 keyboard. I built it and know it works.