# Pressing a key on computer keyboard

jackson6612
Suppose "0" and "1" digits of binary in computers stand for 0v and 5v respectively. Further suppose "A" on the keyboard is the result of this combination "1101". Let's say there are four open switches lying down under the "A" key. When the key is pressed one of the four switches produced 0v and all others 5v in a proper sequence. That sequence of voltages - 5v,5v,0v,5v - flows to the RAM, where it gets recorded temporarily. Then, the CPU notices the presence of the sequence of voltages there and so on.

Am I on the track? Please let me know, and please remember I'm a layman as I'm sure you have figured out yourself. Thanks for your help and time.

Mentor
Suppose "0" and "1" digits of binary in computers stand for 0v and 5v respectively. Further suppose "A" on the keyboard is the result of this combination "1101". Let's say there are four open switches lying down under the "A" key. When the key is pressed one of the four switches produced 0v and all others 5v in a proper sequence. That sequence of voltages - 5v,5v,0v,5v - flows to the RAM, where it gets recorded temporarily. Then, the CPU notices the presence of the sequence of voltages there and so on.

Am I on the track? Please let me know, and please remember I'm a layman as I'm sure you have figured out yourself. Thanks for your help and time.

No. In simple terms, keyboards are scanned in row+column fashion, and the scanning circuit has a "dictionary" (ROM) copy of what each row+column combination should map into, character code wise.

So the scanning circuit energizes column 1, and looks to see if that energization shows up on any of the rows (holding down a key connects the column drive to the appropriate row sense circuit). Columns are energized in a rotating fashion, and the circuit keeps looking for energy coming back on the row sense lines to indicate a key (connection) being held down.

That's way over-simplified, but that's what you asked for.

Fish4Fun
jackson6612,

berkman succinctly explained how a keyboard internally determines which key was pressed. Once the keyboard determines which key is being pressed, it determines if the <Shift> key is pressed. As berkman points out, the result is mapped to a particular ASCII code for that key. The basic ASCII characters range from 0h to FFh (0 - 255) and are then sent via RS232 protocols to the PC. In your specific example of "A", the ASCII character 41h (65 decimal) is sent, which would look like "0100 0001" in binary, and implies either the <Shift> key was depressed, or the <Caps Lock> was set.

From the PC's point-of-view, it does not care how the serial data is generated. When a serial character is received it is simply put into a FIFO buffer until the CPU requests it. For a detailed review of the serial protocol: http://www.computer-engineering.org/ps2protocol/

Fish

jackson6612
Thanks a lot, Berke, Fun.

As I mentioned that I'm a layman, so I'm not much interested in exact details. I wanted to know if I have the general idea right even for a single key. I do appreciate your help but it's just that much of it just flies over the head. So, please let me know if I have the general idea correct? Thanks.

Gold Member
Thanks a lot, Berke, Fun.

As I mentioned that I'm a layman, so I'm not much interested in exact details. I wanted to know if I have the general idea right even for a single key. I do appreciate your help but it's just that much of it just flies over the head. So, please let me know if I have the general idea correct? Thanks.

he layed it out about as simply as possible without getting too technical

Dave