John Hansen says:
Thanks to everyone who offered suggestions about how to help me solve the problem of hooking up an AT keyboard to a PIC. I have found the problem and I thought that I would report the results back here because I have not found this information in any FAQ on the subject.
As you will recall, I had a number of different AT keyboards. I had written software to decode their scan codes and some of them worked and some did not. Some didn't even initialize properly... they just keep flashing their LED's or leaving them on permanently.
As luck would have it, the problem lay in the connector that I was using. I had purchased a PC mount 5 pin DIN socket (Mouser Cat # ME161-0503). This socket was obviously designed for a world in which pin 2 of the DIN connector (the one in the middle of the 5 pins) was supposed to be ground. I say this because when the plug is fully inserted into the socket, this socket connects pin 2 to the metal shell of the DIN connector. But PC keyboards don't use Pin 2 for ground; rather pin 2 is the data line. So, if the keyboard grounds this shell, then the data line is effectively grounded all the time. The Gateway keyboard (and an e-machines keyboard) apparently leave this shell floating, which is why they worked. The keyboards that wouldn't even initialize apparently won't initialize when the data line is pulled low. The keyboard that initialized, but often recognized data 1's as 0's apparently had an intermittent connection.
Anyway, I reached in with a screwdriver and bent the part of the socket that makes contact with the keyboard plug shell so that it no longer makes contact with the shell. When I did this all of the keyboards worked just fine. Upon review of the Mouser catalog, I notice that it offers "shielded" and "unshielded" DIN sockets. The one I bought isn't listed as being either shielded or unshielded, but I think next time for this type of project I'll buy the "unshielded". I suspect it will work fine.
Thanks again to everyone who helped with this project. I stumbled on the solution through dumb luck... I noticed that when the connector was plugged half-way in, it worked fine.
|file: /Techref/io/keyboard/gotchadin.htm, 2KB, , updated: 2002/10/21 06:41, local time: 2021/12/3 20:33,
|©2021 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?|
<A HREF="http://www.piclist.com/techref/io/keyboard/gotchadin.htm"> Hardware Input/Output Port: Keyboard Din Connector Gotcha</A>
|Did you find what you needed?|
PICList 2021 contributors:
o List host: MIT, Site host massmind.org, Top posters @20211203 Neil, Harold Hallikainen, Alan Pearce, RussellMc, Bob Blick, Allen Mulvey, Justin Richards, Dwayne Reid, madscientistatlarge, Sean Breheny,
* Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.
Welcome to www.piclist.com!