Page 1 of 1

Need DIY keyboard emulator serial to PS/2 plans

Posted: Wed Mar 31, 2010 6:28 pm
by KnowItAll
My goal is from the Hyperterm application send ascii text out my PC's serial port and through an
attached device that will convert the serial data to PS/2 keystrokes and out a PS/2 connector
to another PC under test.

Most commerical emulators don't have a serial input connection and are IMO, too costly.
From a learning point, I desire to build and (if needed) programming the deive.

Looking for info, plans, schematics, board layouts, code, etc.

Thanks in advance for your help.

Re: Need DIY keyboard emulator serial to PS/2 plans

Posted: Thu Apr 01, 2010 7:10 pm
by psycho
It is doable with a uC but the p/s2 keyboard is not as simple as you might think.

Read this:
http://en.wikipedia.org/wiki/Keyboard_%28computing%29
Esp. the part under "Control processor". There is a lot more info out there, too. If you find some microcontroller code that uses a keyboard and you can see how to USE a keyboard and then you should be able to emulate it.

Hope it helps,
Kevin

Re: Need DIY keyboard emulator serial to PS/2 plans

Posted: Thu Apr 01, 2010 7:46 pm
by KnowItAll
Kevin, thanks for the lead!
There is a huge learning curve ahead but like anything else, I enjoy learning.

Re: Need DIY keyboard emulator serial to PS/2 plans

Posted: Thu Apr 01, 2010 9:44 pm
by psycho
Here are a few more links that will help you out:
http://www.computer-engineering.org/ps2protocol/
http://www.beyondlogic.org/keyboard/keybrd.htm

Note the term "scan code" - which does not match the ASCII code of the chars. Also, the keyboard sends scan codes not only when you press a key but also when you RELEASE a key.

I work with PIC microcontrollers alot if you need any help with them. I also love working with programmable logic (FPGA's mainly).

It has been a while since I have used a keyboard in a project, though.

Kevin

Re: Need DIY keyboard emulator serial to PS/2 plans

Posted: Thu Apr 01, 2010 10:18 pm
by KnowItAll
Kevin - thanks for keeping the information coming!

I do have experience with the Atmel 8253, using C language.
My background is mainly software - how does one prototype
a project like this? Breadboard? Make a circuit board?

Thanks, Lee

Re: Need DIY keyboard emulator serial to PS/2 plans

Posted: Thu Apr 01, 2010 10:30 pm
by haklesup
I wouldn't try to emulate the PS2 in hardware at all. You should be able to write a VB or C++ program to cause the serial port spit out the data in the correct format for PS2 in one step. The PS2 has mainly a data and clock pin (power and gnd excluded) and is definately serail. The DB9 connector AKA RS-232 serail port has a data pin and any of several other pins that could be used to emulate clock. While it's not as simple as using a hyperterminal and setting the right modem properies, I think its possible without any hardware save for a connector to connector patch cable. I bet you could even emulate data and clock using 2 data pins of a parallel port.

On second thought at the VB programming level, the API functions available may be at too high a level to manipulate the bitstream that precisely. It may be a C job afterall. Another apporach uses a program to reformat an ASCII input file to a binary file which can be sent to a com port. That should be possible at VB level.

Just do a TOPEKA search on PS2 Emulator and all you get are play station cracks. no help there

If you do consider a hardware emulator, I think that USB is a good direction as many USB client modules already have microcontrollers on board and with included code libraries, a firmware program for serial to serial format conversion should be straightforward (but not necessarily simple). I bet you can do this no problem with the eZ430 from TI, the basic one is only $20
http://focus.ti.com/mcu/docs/mcuprodtoo ... olTypeId=1

FWIW, Just brainstorming

Re: Need DIY keyboard emulator serial to PS/2 plans

Posted: Fri Apr 02, 2010 12:20 am
by psycho
Welcome to the party hackles! That actually makes sense to do it all in software. If I were going to do it I would use the parallel port since it is less obsolete than RS232.

The ideal app would be to use USB - I dont think its going anywhere any time soon. You can use a PIC18F2550 and hack through the USB to RS232 sample code and that will give you an RS232 I/O stream in the uC. Then all you would need is a look up table to send the correct scan codes.

There will be issues with this setup if you use a term program. Mainly, you won't be able to get some of the keys (Alt, for example) because the OS eats them. If you don't need them and only need printable chars, you don't have to worry about that.

Since you have used atmel uC's, you might want to check to see if they have a USB version and if it will do what you want. But, if you haven't used a uC for a long time, you might want to use a PIC since more people use them.

Kevin

Re: Need DIY keyboard emulator serial to PS/2 plans

Posted: Fri Apr 02, 2010 11:29 am
by KnowItAll
Thanks tons for all your great ideas - the power of forums!
My local library gets Nuts and Voltsm what a cool magazine.
Any of you read "Make" - one of my favorites.

I like the idea of clocking out keycodes via the serial port.
I could use a scope to check the timing.

From a learning point, I also like the $20 USB approach.

I'll keep you posted on my progress - thanks again!