How does coding physically work?

568 viewsOtherTechnology

Like how exactly can a bunch of letters, numbers, and punctuation symbols make your computer do all kinds of things? Plus what happens inside the computer when it executes the code?

In: Technology

22 Answers

Anonymous 0 Comments

Basically, the central part of this is something called a “bit”. Bit is a value that can be either 0 or 1. Nothing more, nothing less. Physically, 1 means that you pass an electric shock/signal to your microchip and 0 means that you do not pass electricity to it. If your microchip had a lamp on it then 0 would mean no light and 1 would mean light.

Now, if you take 8 lamps in a row, each with its own wire, then you could pass different combinations of electric signals to them. So, for example:

1111000 would light up the first 4 lamps : 💡💡💡💡⚫⚫⚫⚫
10101010 would light up every second lamp: 💡⚫💡⚫💡⚫💡⚫

and so on.

The 8 bits stacked together is called a “Byte”. Since each bit can be 0 or 1, and there are 8 bits, you can have 2^8 = 256 different combinations of zeros and ones in a Byte. This means that you can actually agree with all other people on what each such combination means. You can make up whatever you want. For example, Soviet Union and USA had different values for different Bytes, and right now we are just using one standard agreed upon by everyone in the world.

So, anyway, for example in the ASCII standard

the letter ‘A’ is represented by 01000001 or ⚫💡⚫⚫⚫⚫⚫💡
the letter ‘W’ is represented by 01010111 or ⚫💡⚫💡⚫💡💡💡

This means that whenever you type “AW” on your keyboard it will first send the electricity to the circuit with the pattern ⚫💡⚫⚫⚫⚫⚫💡 and then a second later it will send electricity with the pattern ⚫💡⚫💡⚫💡💡💡. Now the word processor sees the same circuits light up and recovers the letters A and W that you typed on your keyboard and shows them back in your screen.

You can also make calculations using the binary arithmetic. So if you want to compute 5+3 you would pass three things to the computer:

1) it chooses the circuit type – there are lamps that only do adding (adders) and some only do subtracting etc. Whenever you pass two Bytes it will always add or always subtract them no matter what.
2) first number in Byte format
3) second number in Byte format.

So, to sum 5+3 you would choose adder circuits/lamps and pass them:

5 + 3 = 00000101 + 00000011 and the adders would return 00001000, which is 8.

And interestingly enough, every single operation that you do on your computer from clicking a mouse to watching a video can be reduced to such Bytes (combinations of 8 lamps) that are somehow added/subtracted etc. And all of that is about opening and closing electric current that goes to a particular lamp very very very fast.

You are viewing 1 out of 22 answers, click here to view all answers.