Why did we make computers understand 0’s and 1’s and not English?
Someone asked this question on Quora. Here is my answer.
This question assumes that we had the ability to design the underlying language of computers and that we selected ones and zeros. It’s really the other way around. We created a way to store and manipulate information electronically in the form of high and low voltages which manifest as ones and zeros. It’s confusing for humans, but simple for electronic devices to understand because of this thing, the transistor:
We have perfected making these tiny, some of the chips in your computer contain millions of them. When you apply a voltage to the middle pin (B) it lets current flow between the top and bottom (C and E) due to the unique properties of silicon, serving as a voltage controlled switch. If you think of a one as a high voltage, when you apply a one to the middle pin, it lets you connect two things together, even other transistors.
How does this make a computer?
If you put a couple of them together, you can make “logic” gates. Here’s the circuit diagram for an “AND” gate using transistors:
When A and B are 1 (high voltage) Out is 1, otherwise Out is 0 (low voltage).
You can make other functions too:
Storing information
If you put a couple of these gates together, you can store stuff. Here’s a “Flip Flop” latch:
This uses NOR gates. Out is 1 only if A and B are 0. When set (S) is 1 it stores a 0 at Q, and when reset (R) is 1 it stores a 1 at Q.
Doing math
Put a few more gates together and you can do math, heres an adder:
You can build circuits to subtract, multiply, and divide in a similar fashion. You can also build circuits to manage storing and moving things around in memory but they are beyond the scope of this answer.
If you put a bunch of circuits that do math together, you create an Arithmetic Logic Unit (ALU), the core component of a CPU. You tell it two places in memory where you have numbers stored and what you want to do with them, and it will put the answer somewhere else in memory, like so:
Above, we said “Add register 2 and register three and put the result in register 1”, represented by “add $1 $2 $3”. That phrase, “add $1 $2 $3”, actually gets wired to the ALU in the form of 1’s and 0’s. As shown above in decimal as “0 2 3 1”, converted to binary this might look like: 000000 000010 000011 000001
000000 — the operation code that means add
000010 — the destitination register in memory for the result
000011 — the location in memory of the first addend
000001 — the location in memory of the second addend
This is called an instruction, and is what people mean when they say binary is the language of computers. We feed them instructions in the form of ones and zeros. Specifically, when programs written in programming languages get compiled or interpreted, they turn in to strings of instructions that are converted to ones and zeros.
The diagram of a “computer”
Finally, believe it or not we’ve learned everything we need to make a basic computer! Heres the diagram for a basic CPU:
It just reads instructions and either does math or moves information around. Since we can represent letters, colors, positions, and various other forms of information as ones and zeros, this is pretty much all you need. Here’s the ASCII table that shows how letters map to numbers in binary:
It’s rewarding to understand even a little about how computers work when they control so much of the world around you.
Give me a follow on LinkedIn and Twitter to learn more about computers and software:
https://www.linkedin.com/in/jakespracher/
References
- Diagram of a transistor AND gate. Reference: http://hyperphysics.phy-astr.gsu.edu/hbase/electronic/and.html#c1. CC BYSA 3.0
- A simple yet powerful animation of how an R-S flip-flop works. Napalm Llama. CC BY 2.0