# how do commands on a screen direct electrical currents in a computer?

31 views
0

I’m not asking what computer code is. I’m asking how typing in commands physically opens/closes the little switches in computers?

In: 2

the code you see on the screen is just the electronics of the computer representing for you what some of those little switches are in the particular part of memory. so you might have 101110001000001010101 in memory and the program currently running might instruct the computer to send a representation of that data to the video card and from their to the screen, until you end up with (say) “input” on the display.

i say all this to highlight that it’s the data in memory that the computer works with and drives everything.

now the user might “compile” the program they’re working on which, depending on the language, might change the human readable code that was being worked on in the program editor into individual binary codes that the CPU was designed to work with. it’s this binary code that’s stored and run when you run a program.

really the 1’s and 0’s of that compiles program are just sets of switches that the CPU reacts to in really really realllly complicated ways.

for example (big simplification), sending
00000001 (the number one)
00000011 (the number three)

to the CPU might cause it’s switches to react such that 00000100 is presented on the output (and this happens to represent the number 4)

this is a gross simplification, but i put it like this just to point out that really everything the computer does is just different parts of it responding to the switches set in the input data

note: all example numbers / commands totally made up

to get a bit of intuition on how complex behaviour can boil down to switches – [see something like Turing Tower in action on youtube](https://www.youtube.com/watch?v=1aOQMcYubl8), it’s a game where you build logical operations (and even some number calculations) using just plastic switches and marbles that tumble through them

When you call for a command, that set of instructions (in binary code) is registered by your various forms of RAM.

The RAM itself is a set of physical gates that uses Logic Systems to execute that code on a physical (electrical impulse) level, converting 1’s and 0’s into On and Off signals, which are then relayed through the physical medium of the motherboard to your processors.

i.e. RAM *is* your little switches.

Basically, you think you’re typing words and meaning into the keyboard, but in reality you’re just pusing the correct “combos” to turn on a peripheral. As if the keyboard was just a TV remote control. Ctrl-Alt-Delete just more complicated.

The CPU and memory are “blank canvases” of switches (transistors). A large set of dominoes, all of the blocks set upright next to each other. Software (Windows) pre-toggles some of these switches to create “pathways”, like rotating some of the domino blocks so that when they topple, they’ll chain-topple towards the screen or towards the DVD burner or whatever.

You press the correct combo on the keyboard and that triggers the first transistor, topples the first domino block. The rest topple along based on the path set up by Windows, and the final transistor topples the DVD burner for example.

A “switch” in a computer is a tiny piece of semiconducting silicone, with a few connections running to and from it. The “semiconductor” part is important: give it little bit of electrical nudge and it will conduct. Nudge it the other way and it won’t conduct. Voila! We have a switch which we can control electronically.

We can arrange a number of these switches into a slightly more complicated switch which takes two input signals rather than one, and it will set the switch to ON if (and only if) the inputs are not both ON.

And we can arrange a number of *those* little circuits to do all manner of wonderful things.

One thing we can do is to store the ON or OFF state of a tiny little circuit. Put a bunch of those little tykes next to each other and you can store a binary number, the 0’s and 1’s you asked about. Next to those switches which represent the number will be *more* groups of switches which do something with that number. In some areas of the chip ww treat the number as a value. In others, we treat it as an instruction. The particular combination of ON/OFF values of the switches (the 0’s and 1’s) will activate a specific set of switches, and that specific set of switches will cause a bunch of *other* switches to fire, and the end result will be that the particular instruction corresponding to that binary number has been executed.

Sooooo… you type a ‘1’ on the keyboard. Pressing the key closes a bunch of switches inside the keyboard, sending a particular set of voltages (ONs and OFFs) to the computer. To the computer, they cause a “keyboard interrupt” signal, which says there’s new info from the keyboard, and an arrangement of ONs and OFFs to tell the computer which key was pressed. Somewhere some switches are hooked together in such a way as to say “if you’re not in the middle of something uninterruptable, route the value on the keyboard input to the appropriate place”.

Hope this helps.

computers are made of layers of complexity. At the base level, you have the hardware. This is the physical thing. Electricity flows through it. Depending on how it flows, switches (transistors) open or close. Very early computers were just this level. They had mechanical switches that would send electricity down one path or another and then they would see the result.

The next level above this is the bios. This is a program built in to the microchips that take over the role of those mechanical switches from above.

Next is the OS. This is more complicated, with lots of tools, but it can translate everything into the simple language that the bios speaks.

Finally, there are applications. They manipulate data, they talk to the os, which talks to the bios, which talks to the hardware.