Menu

Close
Menu

Why do we use 0 and 1 in digital devices

Why we use zeroes and ones in digital devices

You have probably heard about how every digital device basically uses zeroes and ones to work. But we know that devices such as computers and cell phones can be used for so many diferent purposes, can all their work be just about zeroes and ones? Let’s find out.

What is binary

Binary is a system of counting, there are actually a lot of different systems, that existed for a long time. A few examples are

So binary is a counting system that starts with 0 and counts up to 1, and then we add a new digit. How would that work in practice? Here are few example numbers (left decimal, right binary)
0 – 0
1 – 1
2 – 10
3 – 11
4 – 100
5 – 101
6 – 110
7 – 111
8 – 1000
9 – 1001
10 – 1010
and so on.
You might be wondering how would 2 equal 10? Well it is not actually 10, what is means is that we have zero ones, and 1 twos. Here is a better visual representation


So if we want to write 10 in binary it would be 1010, which means starting from right side, we have zero ones, we have one twos, we have zero fours and we have one eights. If we combine them we have 2+8, which is ten.

What is a transistor

A transistor is an electrical component that can act as a switch. It is made of a semiconductor (an element of conductivity, its resistivity falls as the temperature rises which can be useful in computing), usually silicon. The semiconductor conducts electricity better than an insulator but not as good as a conductor.
We can change a semiconductor to conduct electricity a lot better by for example adding an element with a different number of valence electrons. There are many types of doping by adding different elements to the silicone.

The two most well-known are n-type and p-type. In the n-type, we add an element with more valence electrons, which adds extra electron compared to the silicon and it can move through the silicon. The p-type is achieved by adding an element with fewer valence electrons. Transistors have different types of use of this effect. There are NPN and PNP transistors, which are created by multiple layers, for example, NPN is made with n-type layer then p-type layer, and then n type added together. This will create a free and not-free environment for the electrons to flow. The electric current would flow through the transistor from n type to p type, but will no longer conduct electricity after the electrons of n type flow to the p type space. Then we can get electrons to move through the transistor by supplying it with voltage. So the transistors can work as an on or off switch.

Why do we use binary in digital devices

If we want computers to work with different counting systems, we can use transistors representing the numbers. So for example a number ten would mean we need 10 on switches, but as we need bigger and bigger numbers such as 1,000,000 and we want to make subtraction or multiplication you see how this has very big limitations, as there is not enough space to add enough transistors in a CPU of a computer to do complex counting and calculating.

The most logical way would be to simply replace on and off state of the transistor with a counting system that fits that requirement, so a binary comes into play. For example, we can represent the number 10 by having 4 transistors in a row, which are ON OFF ON OFF = 1010 which we can convert to decimal, we have zero ones, we have one twos, we have zero fours, and we have 1 eights, so 8+2=10.

What is a bit

You have probably heard Kbit, MB, GB, TB and other units of measurement, and you have probably heard about the bit and byte, you might think this is just misspeling or something similar, but no – there is a difference.

A single transistor can have 1 or 0 (so on or off state), and it is called a bit. So if we have 10 transistors on =1111111111 this would mean 1023 in binary would mean that we have 10 bits of information.
However we often use byte, and there is a big difference in the two.

A byte is actually 8 bits together. Which means that 1byte or 8 bits can represent number starting from 0 to 255 (there are actually 256 values, but we start from zero). If you are confused why we can have up to 256 values in 1 byte? Well if we have 8 bits and they are all ON state so the maximum number, this would mean 11111111, we start to add the numbers we have one ones, one twos, one fours, one eights, one sixteens, one thirty twos, one sixty fours, one one hundred twenty eights (1 2 4 8 16 32 64 128) and we add them up 1+2+4+8+16+32+64+128 we get 255.

How do we use binary in computers

You might be wondering, well okay numbers are obvious, but how do computers create all other tasks, for example, letters? Well for the standard symbols and upper and lower case letters we have ASCII, which is American Standard Code Information Interchange. It is a table that assigns a symbol to each value represented by a byte.
As we know a byte has a maximum of 256 values so we have 256 different symbols in the table. Here is an example
Decimal numbers start from 48 positions, so number 48 represents 0, 49 is 1, 50 is 2, 51 is 3, and so on. Uppercase letters start from number 65, so 65 is A, 66 is B, 67 is C and etc, then we have symbols such as [ / ] ^ _ and etc. You can look up an ASCII table on google to find more.

Types of ASCII tables

There are generally two types of ASCII Tables, one is the standard version which has 128 values, and there is an extended ASCII which adds an extra 128 and in total is 256.
You might ask why is only 256? Well, 256 is the maximum number of 1byte (11111111) so one byte can represent a single-digit or symbol.
Now you understand that a text such as “Hello” would be converted by the computer to 0 and 1, in this example it would be 5bytes (since there are 5 letters) and if we check the ASCII table it would be converted to numbers 72 101 108 108 111 (each number representing a symbol, 72 is the capital letter H, 101 is the position of the lower case e, 108 is lower case l, and 111 is lower case o).