4.10.12

What Is Binary?

AppId is over the quota

Back in the day, there were machines, called mainframes, that took up an entire room. People fed in strips of paper with holes in them which served as instructions for these giant computers to process. There was either a hole or there wasn't, because it is the only thing a computer understood then, and it is still the only thing a computer understands today: 1's and 0's.

Binary is another word for "two." It is a fundamental expression used to describe anything that consists of two and only two parts. Here are some examples of its usage:

In mathematics, the binary numbering system has base 2. You will at some point see one or more of these numbers as you continue to use technology: 16, 32, 64, 128, 256, 512, 1024, 2048 (all powers of 2).In astrology, a binary star is not just one star, but two stars orbiting each other in an endless loop.In electrical engineering, circuits are in one of two binary states: on (electricity flowing) or off (no current).

Computers are electrical devices that are able to utilize binary at a more advanced level because programmers (people who write software for devices like computers) have come up with a way to convert electrical on and off signals into a human readable language simply by grouping these signals and assigning letters and numbers to them.

For example, every time a set of signals comes through as 11001000 (on, on, off, off, on, off, off, off), it is converted to C8 in hexadecimal (base 16 numbering system) which is obviously shorter to write and easier to remember. However, C8 in and of itself still doesn't mean a whole lot to us and so programmers took it a step further and began to also group and label those hexadecimal values into higher level words like CMP (compare), JMP (jump), and RET (return). This routine quickly expanded and came to be known as assembly language, still in use today. Assembly, we could say, is a low-level language used to control computer hardware and handle information processing essential to a normal working computer.

Fortunately, you do not need to learn how to convert binary or write instructions in assembly in order to perform day-to-day operations. Instead, we now have the ability and resources available to download a a pre-written software program of our choosing and simply run it.

Now let's look at converting a base 10 number into binary (base 2). Have out a piece of paper and write these down along with a scientific calculator handy.

Binary is converted by using the base 2 numbering system. Take the following powers of 2 for example:

20 = 1
21 = 2
22 = 4
23 = 8
24 = 16
25 = 32
26 = 64
27 = 128
28 = 256

We can keep going upwards from here, listing each power of 2. The goal is to have the highest power of 2 fit just one time into the number you want to convert to binary. For example, if the number we want to convert is 500, we would stop at 28 because 256 goes into 500 just one time. If we tried 29, we would quickly figure out that 512 does not go into 500 and so we don't need to go that far. This is the initial starting logic.

Shown below is a literal rinse and repeat process that leads you to converting any number into binary using simple arithmetic now that we have our starting number, 28:

Does 28 (256) go into 500? If yes (and it does), we write down a 1. If no, we write down a 0 instead.
Now take the difference of 28 (256) and the number we wish to convert, 500 (subtract 256 from 500). This gives us our new number, 244.
We evaluate this new number against our next expression in line, 27 (128) with our new number in hand as we continue to work backwards toward 20.

Does 27 (128) go into 244? If yes (and it does), we write down another 1 next to the previous 1. If no, we write down a 0 instead.
Now take the difference of 27 (128) and our new number, 244 (subtract 128 from 244). This gives us a new number of 116.
We move on to our next expression in line, 26.

Does 26 (64) go into 116? If yes, we write down another 1. If no, we write down a 0 instead.
Now take the difference of 26 and 116 (subtract 64 from 116). This gives us a new number of 52.
We move on to our next expression in line, 25.

Does 25 (32) go into 52? If yes, we write down another 1. If no, we write down a 0 instead.
Now take the difference of 25 and 52 (subtract 32 from 52). This gives us a new number of 20.
We move on to our next expression in line, 24.

Does 24 (16) go into 20? If yes, we write down another 1. If no, we write down a 0 instead.
Now take the difference of 24 and 20 (subtract 16 from 20). This gives us a new number of 4.
We move on to our next expression in line, 23.

Does 23 (8) go into 4? No it does not. Write down a 0 here.
We move on to our next expression in line, 22 and revisit this same question.

Does 22 (4) go into 4? Yes it does, so we write a 1.
Now take the difference of 22 and the same number 4 (subtract 4 from 4). This gives us a new number of 0.
Although 0 has become our new number, we must finish out the remaining expressions. This is easy as you can simply fill in 0s at this point.

Does 21 (2) go into 0? No it does not. Write down a 0 here.
We move on to our last expression in line, 20 and revisit this same question.

Does 20 (1) go into 0? No it does not. Write down a 0 here.
Once we've reached 20, we are done.

Now look at your paper with 1s and 0s on it. It should look like this: 111110100. If we were to reverse this entire process, adding up powers of 2 in ever place where we wrote down a 1, we would arrive back at our original number, 500.

What we do at this point is separate the digits of our binary number into groups of 4, starting from the right, and adding leading 0s on the left when we're finished so that each group as exact 4 digits (if any are needed).

First let's spaced them out into groups of 4: 1 1111 0100
Now add in the leading 0s: 0001 1111 0100

We now have an accurate binary representation of the number 500: 0001 1111 0100

Incidentally, each digit of a binary number occupies 1 bit of memory. There are 8 bits in 1 byte and here we've made it easy to see exactly how many bytes of memory the number 500 would occupy:

0.75 bytes (or three quarters of a byte).

Read more hardware related articles from MyNanoTech.com at http://mynanotech.com/computer-basics/hardware


View the original article here

No comments:

Post a Comment