What happens physically when the user interacts with the computer, when a button is pressed on the keyboard for example?

22 views
0

The question is the basics of how a computer works, most people seem to think it is magic or something, I would like to understand.

Is it an electric charge that goes on a chip? how does that translate into a screen?

In: 2

Each key floats over a pressure pad. When the key is pressed, the pad is activated and an electrical signal gets sent to the motherboard (operating system) that the letter is being pressed. The motherboard processes the data, then sends a signal to the monitor, effectively making the letter appear on the screen relative to what key you pressed. That’s how I understand it at least.

Computers run code, but also do input and output, or I/O. There are way too many ways this happens to even summarize. Input devices convert whatever they are doing into numerical information, then code running on the computer interprets it. It then can send data to an output device. These devices use a wide variety of circuits. In the case of a keyboard, there are matrix decoders, shift registers, and others. There are lots of books on computer basics and digital electronics, I’d check one of those out.

Each button is an electric switch. When you press it, it sends an electrical signal. This signal might or might not get processed or modified by the circuitry in the mouse/keyboard.

That signal travels through the wire connecting your mouse or keyboard to your computer.

Whatever plug your mouse or keyboard is plugged into (say, a USB) receives that signal.

Your operating system frequently checks each of the inputs that it’s aware of to check for a signal. It notices that a signal is present and checks which signal is present.

Your operating system checks for programs that are listening for input. (Mechanically, those programs have a loop in them that says “every frame, if the user has pressed the left mouse button then…”). It then sends the input to those programs.

The programs decide what to do with the input. If it’s a word processor, for example, pressing “w” instructs it to add a “w” to the end of the data in your current document. If it’s a video game, pressing “w” might cause it to increase the vertical speed of your character. And so on.

At the very start of a button press it bounces, or sometimes just doesn’t quite but mostly connects. So the first part is a tiny circuit that de-bounces the button press to make each press into a single press.

Way tooo many things are happening, but its a combination of electrical circuits having a change in voltage or current, then it is sampled, then converted to different types of code, ran through a CPU, then changes to different codes again, goes to RAM, leaves RAM, goes back to Gpu, gets read again in different code, the new code is sent to the monitor, and then changed to voltage current again. Wayyyy too many things to explain, but it takes a lot to make a computer work 🙂