How can I connect a standard PC keyboard to a PLC?

  • Thread starter Abishek Chandramohan
  • Start date
A

Thread Starter

Abishek Chandramohan

I need to connect a standard computer keyboard to a PLC or for that matter any customised microcontroller based system. i believe this is very much possible, given the fact that the keyboard gives a serial o/p code of the key pressed. de-bounce and everything taken care of. The problem is, how exactly to do it?
 
Rarely does a PLC have the ability to directly read the serial stream that a PC keyboard generates. It can't normally directly handle the separate clock and data line on the keyboard connector. You are better off buying an ASCII keyboard, which could be plugged into a standard serial port, if your PLC has one.

Since systems with keyboards often have displays as well, you're often better off just interfacing with an inexpensive PC system.

If your goal is to put multiple keyboards on a single system there are also keyboard/monitor/mouse sharing devices available.

But if you really want all the gory details of interfacing to a PC keyboard, one informational site is http://www.beyondlogic.org/keyboard/keybrd.htm

It is more for a general customized microcontroller system. If you use it for a PLC, you'll probably create your own serial converter (or buy one) to interface to a PLC serial port.

Good luck.

Rufus
 
B

Bob Peterson

I believe standard keyboards are serial but at a TTL level. IIRC, Blackbox can sell you an adaptor dohickey to bring it into a std rs232 port.

Bob Peterson
 
J

James Ingraham


I don't. PCs use keyboard controller chips to talk to the keyboard. Some modern systems integrate this chip into a "Super I/O" controller or the Southbridge chipset, so don't be too surprised if you open your system and don't see the chip on your motherboard. Apparently it is possible to emulate the controller in software, but I don't think this is trivial to re-create. There's a nice picture of how to use a keyboard controller at www.soem.ecu.edu.au/units/ens2257/others/keyboard_interface.pdf

 
C

Curt Wuollet

One of the easier solutions is to throw the keyboard's encoder away and treat it as a cross-point matrix with standard inputs. Lots of wires but it's positive. Or make an 8 bit parallel output encoder. Either of these gets interesting supporting shifts, controls and multiple key combinations. It might be a good Stamp application to accept the standard keyboard and send unambiguous result codes to the PLC.

Or simply use a software PLC running on a PC which provides excellent support for PC keyboards. At some point, it makes much more sense to add PLC functionality to a PC than it does to attempt to add PC functionality to a PLC. It's cheaper and far more powerful as long as you use software of comparable reliability. Even if you do get your keyboard interfaced, creating the equivalent of a tty discipline on a PLC would be quite, ummm....interesting. It's much easier to program a PC to do logic, since they already do logic.

You could look at http://mat.sf.net or I could send you a rudimentary PLC demo written for Linux. Both are free.

Regards

cww
 
Top