Thursday, December 17, 2015

Keyboard scanning

I got into an argument with an electronics engineer some time ago about how amazing computers are vis-a-vis electric typewriters. Well, a discussion really, but it got rather animated.

I had made a comment about how fast the computers scanned the keyboard for input, for you could hit multiple keys at seemingly the same time and the computer would have scanned through the entire keyboard multiple times and caught all of the inputs.

The engineer argued that the computer was not really scanning the keyboard, but was only waiting for an electric circuit to close and as soon as the current came through, it registered the keystroke. Here is my argument on why I thought the computer was scanning each key in sequence as against just registering keystrokes when a key circuit was closed.

I figured that the average computer keyboard cable had no more than 5 wires in the plug that connects to the desktop unit. The average keyboard has about 100 keys. For the keyboard to work on a 'close-the-electrical-circuit' basis, one would expect the cable to have at least 102 wires. Given that the entire caboodle worked with only 5 wires, for GROUND, 5V DC, CLOCK and DATA, the computer had to be working on some system of coded signals on the same data wire to differentiate each key; implying that it needed to scan each key in sequence to be able to catch 2 keys that were simultaneously depressed. Somehow, I did not have him convinced.

I wonder how I could have made my case stronger.

2 comments:

Ali said...

I don't think he was entirely wrong...
http://computer.howstuffworks.com/keyboard.htm

Mohit said...

I don't understand the protocols completely, but thought this would give you a starting idea of how the Data + Clock communication protocol works for keyboards - http://www.computer-engineering.org/ps2protocol/