Live data from Hacker News

Keyboard Ghosting Explained

microsoft.com

91–99 of 99 posts

Re: Keyboard Ghosting Explained

#91

In the high school computer lab, after I showed my friends how to disconnect from the Novell network so our instructor couldn't watch what we were doing, we used to play a very good Street Fighter 2 clone. I quickly learned all about keyboard ghosting and used it to my advantage to block my opponent from blocking my attacks. When I tried the same tactic on my computer at home, I discovered it didn't have the same pro…

I used to run Screen Thief when playing two player DOS games. It seemed to help certain key combinations work better. I credited this (whether accurate or not) to ST relocating IRQs.

Re: Keyboard Ghosting Explained

#92
post #10
post #2

Microsoft make some of the best keyboards there are. Just did some tests on my Sidewinder keyboard, no issue at all there.

Microsoft used to make some really good keyboards. But about 8 years ago they started making junk. The last MS keyboard I could actually type on was the Wireless Multimedia one (now discontinued). Keyboards in the last few years have had: - Mushy key feel. I can't tell when I've actually done a keystroke. - Keys that are hard to strike (need to press on them just right, or they hang up or don't register). This is par…

I see this comment quite a bit, with regard to not being able to detect a keystroke, and I honestly don't understand it.

For one, I type far too quickly for auditory feedback to be of any meaningful use. Second, a combination muscle memory and spring feedback usually catch situations where I've missed a key (I can feel that I hit it too lightly). Third, I find some of the mechanical keyboards to be too stiff and require more force to fully press each key, leaving my arms more fatigued at the end of the day.

I suppose it's individual preference, but the soft clicking I get from my laptop or Microsoft ergo keyboard (low-travel laptop style keys) are more than enough for me.

To add to your list of keyboard gripes though:

- Keys with sloped sides (an extension of "keytops too close together") that cause me to hit adjacent keys when I slightly miss

- "Fn" and Ctrl keys swapped. I was working with keyboard in a seldom-used office yesterday that caused me to repeatedly clear lines when I meant to hit Ctrl+C. I will be replacing that hunk o' junk.

- Absolutely no separation between Function keys and numeric keys.

Re: Keyboard Ghosting Explained

#93
post #27

I wrote a shoot 'em up for PyWeek and I got a report from one of the judges of the challenge saying the controls didn't work very well. I didn't know what was going on at first, because looking at the code it was "perfect", but turns out using the arrow keys for direction and space for shooting was a bad idea because a diagonal movement (up and left) when shooting won't work in some keyboards. Since then I use z for…

Just a note from the non US world: Please have such keys customizable. z is an especially awkward choice, because with qwertz it is between the t and u and thus far from all the other keys you might use for your gameplay.

Re: Keyboard Ghosting Explained

#94
post #56

I am always amazed that keyboards still do this. We have scanning matrices because back when I was a new engineer pins on a microprocessor were both expensive (larger packages) and they required more gates in the CPU (more expensive CPU) or chip doing the scanning. Today transistors are free and surface mount BGA packages can put down a lot of pads pretty simply[1]. So your typical 104 key keyboard could actually hav…

Indeed there are now lots of high-end keyboards with no (or effectively almost no) keyboard-matrix ghosting problems. Actually, many of them still have USB-related rollover limitations: it's hard to fathom how someone can design a brand-new USB keyboard with no rollover limitations in the keyboard matrix, price it at $100+, and still not think (or bother?) to implement the obvious multiple-USB-keyboards workaround—lo…

The method that some manufacturers are using to obtain NKRO is to have the USB keyboard enumerate as several HID keyboard devices at once, and map physical keys to virtual keyboards.

Re: Keyboard Ghosting Explained

#95
post #72
post #65

Earlier quoted context omitted.

But there are no two keys connected to the same output wire at the same time. If I put the value: 00100000 onto the input register, and I get: 01000000 on the output register, that can only correspond to one key at the time I read the register. EDIT: I think perhaps you're underestimating how quickly a microcontroller can scan a keyboard. If I press 2 keys simultaneously that are both connected to the same output pin…

The problem happens when you press three or more keys at once in right combination. And is exactly the same regardless whether you scan output wires in sequence (as is done in simple hardware based keyboards of the 70's and 80's) or if you read them all at once. Going back to your original example, if one would press keys 1, 2 and 6 at the same time your microcontroller would falsely detect 7 as being also pressed (b…

Here's a dramatically simplified diagram to illustrate the principle:

https://db.tt/Fvs0xBpd

If I put a voltage on pin 2, and key A is pressed, I will get a voltage at pin 1. If I put a voltage on pin 3 and key B is pressed, I will get a voltage at pin 1.

It doesn't matter if both are pressed simultaneously because I am reading them sequentially.

All you have to do is scan the keys quickly enough that someone can't "sneak in" a key press in between scans which turns out is possible with even the lowest powered hardware.

Re: Keyboard Ghosting Explained

#96
The ZX Spectrum in 1982 (and I'm quite sure its ancestors ZX-80 and ZX-81 from their eponymous years) had a keyboard just as cheap or cheaper, with a similar matrix arrangement), but had no ghosting at all:

Instead of having an "all hot" electrical configuration, it would cycle through the rows with a "one hot" configuration, and read the columns. If I recall correctly, it would be something like 20 cycles of a 4Mhz Z-80 to read one 5-column row (you'd need 8 of them to read the entire 40-key keyboard), and it was done every 50hz/60hz interrupt by the main CPU - modern keyboards have an ASIC on par or 100 times faster than a Z-80 just for the keyboard.

Re: Keyboard Ghosting Explained

#97
post #40

I am always amazed that keyboards still do this. We have scanning matrices because back when I was a new engineer pins on a microprocessor were both expensive (larger packages) and they required more gates in the CPU (more expensive CPU) or chip doing the scanning. Today transistors are free and surface mount BGA packages can put down a lot of pads pretty simply[1]. So your typical 104 key keyboard could actually hav…

A serial bus of unique identifier switches (1wire or similar) connecting all the keys with a single loop could be cheaper at scale and solve NKRO. Possibly work on many vastly different (a few buttons to hundreds) product lines with the same ASIC with say only one or two support components per application.

It couldn't possibly be any cheaper than just having one diode per key though, could it?

Re: Keyboard Ghosting Explained

#98
post #95
post #72

Earlier quoted context omitted.

The problem happens when you press three or more keys at once in right combination. And is exactly the same regardless whether you scan output wires in sequence (as is done in simple hardware based keyboards of the 70's and 80's) or if you read them all at once. Going back to your original example, if one would press keys 1, 2 and 6 at the same time your microcontroller would falsely detect 7 as being also pressed (b…

Here's a dramatically simplified diagram to illustrate the principle: https://db.tt/Fvs0xBpd If I put a voltage on pin 2, and key A is pressed, I will get a voltage at pin 1. If I put a voltage on pin 3 and key B is pressed, I will get a voltage at pin 1. It doesn't matter if both are pressed simultaneously because I am reading them sequentially. All you have to do is scan the keys quickly enough that someone can't "…

Ghosting is with three keys pressed: If there is a key A that is in the same row as a key B plus and also in the same column as a key C, then a fourth key (the 'ghost') appears to be pressed in the column of key B and the row of key C due to the shorting of the rows and columns, also in your scheme.

Re: Keyboard Ghosting Explained

#99
post #98
post #95

Earlier quoted context omitted.

Here's a dramatically simplified diagram to illustrate the principle: https://db.tt/Fvs0xBpd If I put a voltage on pin 2, and key A is pressed, I will get a voltage at pin 1. If I put a voltage on pin 3 and key B is pressed, I will get a voltage at pin 1. It doesn't matter if both are pressed simultaneously because I am reading them sequentially. All you have to do is scan the keys quickly enough that someone can't "…

Ghosting is with three keys pressed: If there is a key A that is in the same row as a key B plus and also in the same column as a key C, then a fourth key (the 'ghost') appears to be pressed in the column of key B and the row of key C due to the shorting of the rows and columns, also in your scheme.

There are no columns in this design. The behaviour you're describing can't occur since this isn't a 2d matrix of keys. The keys are grouped such that putting voltage on an input pin will result in an output voltage on many pins depending on which keys are pressed at the time.
Post reply on HN