Posted: December 10, 2005
Written by: Dan "Tweak Monkey" Kennedy


You will never truly master computers until you can clearly communicate their language.

If you only speak one language you will have less opportunities and options in life than if you spoke more. By acquiring the ability to communicate with more people, you open new doors for business opportunities and relationships. Given this fact, it makes sense that you would benefit from the ability to communicate with anything. Electronics and computers, which are becoming more important to daily life at an exponential rate, have their own language and it is important that you understand it.

At the lowest level, computers communicate in a simple language called Binary. While the language can be taught in a few minutes, most people won't really learn it for years. I was first taught binary several years ago, but through wisdom acquired while programming with assembly, a low-level programming language, I truly learned the language a few years later.

It is critical that anyone hoping to understand, repair, and troubleshoot computers has a complete understanding of this language. It is the most important fundamental topic to grasp with computers and will ultimately determine your success with them.

Lesson 1: Vocabulary

The binary language is so simple! It only consists of two words: 1 or 0 (also known as On or Off, and Yes or No ).
1 = On
0 = Off
Even though binary only has two words, they can be used to represent anything. The numbers can be used to represent other numbers, which can represent data, and so-on. We'll explain how later.

So 1 = On and 0 = Off. What does this really mean?

Lesson 2: Representing Logic with Binary

Binary represents everything as an on/off switch. Look at a light switch and imagine it says 1 at the top and 0 at the bottom. Take this question: Is the light on? The position of the switch answers the question. If the switch is flipped to 0, the answer is No - the light is Off. If it's not off, it must be on.

Switch set to 0                                                      Switch set to 1

Here's a sample computer program for controlling the light switch:
integers switch, light;    // variables representing state of switch and light
switch = off;                  // initialize switch to off position
light = off;                     // initialize the light to off
LightStatus(){               // a function to represent status of the light
if (switch == 1)             // if the switch is turned on
       light = 1;                // then the light turns on
else                 //otherwise the switch is off
       light = 0;                // so the light is turned off
The value of the light switch is checked by the function LightStatus. When it's On (switch = 1) it turns the light On (light = 1). Binary can be used to represent the answer to any Yes or No question. Is the light on? Check the value of the variable light for the answer. This is exactly how software determines the answer to a question and at a lower-level, how the hardware knows what it is supposed to be doing.

In front of you there is a computer monitor. There is a light at the corner of this monitor representing its status. Usually green light = on, amber light = standby, and no light = off. Hard-coded electronically into the monitor is a circuit that tells the light what to do. It asks two questions: Is the monitor switched on? and Is the monitor in standby mode? If the answer to the first question is No (or Off, 0) [determined by another circuit], this circuit sends it no power and the light stays off. Otherwise it moves to the second question and determines whether to illuminate the green or amber light.

Representing numbers in binary allows unlimited application of this logic.

Lesson 3: Representing Numbers in Binary Using Bits

Those 1s and 0s can be used to represent any numbers. Numbers can then be used to represent other objects. How can you represent any number using binary? Using Bits! Bits are just binary digits, or 1s and 0s that can be used to represent larger numbers.

The decimal number system is our most common number system and has 10 choices for its digits (0 through 9). A string of decimal numbers uses multiple digits, such as 147 (one hundred forty seven). The understanding of the single digits allows you to understand the string of digits. Binary uses 2 possibilities (0 or 1) to accomplish the same task. The number 2 for example, can be written as 1 0.

Since there are only two possible symbols to represent the numbers, two is created by using a second digit. This is done using the power of 2 instead of the power of 10 like decimal.

In decimal, 101 represents the following summation:
   (1 * 10^2) + (0 * 10^1) + (1 * 10^0)
= (1 * 100) + (0 * 10) + (1 * 1)
= 100 + 0 + 1
= 101

In binary, 101 represents the following:
   (1 * 2^2) + (0 * 2^1) + (1 * 2^0)
= (1 * 4) + (0 * 2) + (1 * 1)
= 4 + 2 + 1
= 5

Converting to Binary

To convert the number 547 to binary, you need to first determine the most significant digit of its binary string. Look at the powers of 2:
2 ^ 0 = 1
2 ^ 1 = 2
2 ^ 2 = 4
2 ^ 3 = 8
2 ^ 4 = 16
2 ^ 5 = 32
2 ^ 6 = 64
2 ^ 7 = 128
2 ^ 8 = 256
2 ^ 9 = 512
2 ^ 10 = 1024
Find the highest number that fits into 547 at least once. A quick glance shows it's 2 ^ 9 = 512. The most significant bit in your binary string would be its 10th bit (don't forget to count 0!), valued at 1.
1 x x x x x x x x x
9 8 7 6 5 4 3 2 1 0

(the Xs will be figured later)

We need the remainder of 547/512 to continue. Take 547-512 = 35. Now the process continues. The next number that 35 fits into is 2 ^ 5 = 32. So our 6th bit will be 1. All numbers between the bits equal to 1 must be 0s or the value would be incorrect when the sum is computed. So far we have:
1 0 0 0 1 x x x x x
9 8 7 6 5 4 3 2 1 0

Find the remainder of 35/32. Take 35-32 = 3. The next value is 2 ^ 1 = 2. Our 2nd bit is 1.
1 0 0 0 1 0 0 0 1 x
9 8 7 6 5 4 3 2 1 0

For the last step, our remainder 1 (from 3/2 = 1 r1) can only fit in 2 ^ 0 = 1
1 0 0 0 1 0 0 0 1 1
(the completed binary string)

Calculators can speed up this process considerably. Try running the Windows calculator (Start, Run, calc [hit enter or OK]).
Set the mode to Scientific (from View at the top). Input 547, then click the Bin button. Experiment with some basic math like subtracting 1 or 2, and convert back to decimal frequently. You'll see patterns emerge.

Binary digits can represent states of various switches and can combine to represent numbers, letters, words, documents, programs, computer software, computer hardware, and all electronic circuits at the basic level. A 10-bit number like 547 can be represented by 10 switches toggled to the correct On/Off setting.

You've probably seen the term byte before. A byte is a chunk of 8 bits. This makes it easier to represent large numbers. If a file is downloaded at 6 kilobytes per second, it is downloaded at 48 kilobits per second, or less than a 56Kbps (kilobit per second) modem's maximum speed.

A kilobit is 2^10 bits, or 1024 bits. A kilobyte is 8 times this number, or 1024 bytes.
A megabit is 2^20 bits, or 1,048,576 bits. A megabyte is 8 times this number, or 2^20 bytes.

Some people think a 56K modem can download at 56 kilobytes per second. It is physically limited to 56/8 = 7 kilobytes per second, though the FCC limits it to 54 kbps.

Lesson 4: Representing Anything with Binary

You can create any number with binary, even numbers less than 1 (you'll usually use tricks, like representing negatives or fractions with extra bits in the front of the number). There are 26 letters in the alphabet, so they can be assigned numbers. You may have heard the term ASCII, which represents the alphabet and other characters with specific numbers.
Take the word cab for example:
c a b
c = 3 (decimal) = 11 (binary)
a = 1 (decimal) = 01 (binary)
b = 2 (decimal) = 10 (binary)

Using long strings, one could make whole sentences including punctuation. Then documents, music, operating systems, or any data in binary. Ever wonder how a document is stored in a computers memory? Using bits. Thousands of 1s and 0s are chained together to form words, formatting, and just about anything you could imagine. Everything you see right now is being represented in your computer's memory by an electric current. Over a million pixels' colors are represented as 1s and 0s, strategically placed in front of you to represent the image your video card is sending to your monitor. You could flip a single 1 to 0 in your system's memory and crash the whole computer or change something as small as a single pixel by a fraction of a color shade.

For example, assume you set the font color to black, which in 24-bit color mode is:
00000000 00000000 00000000

If you change just a single bit:
10000000 00000000 00000000
The color of the font changes considerably

Putting it All Together

Now you know what a bit is, how a bit works, and how a computer uses electric switches just like a light switch to operate. You're probably still scratching your head thinking, "why did I learn all this?"

Binary is the language of electronics. It makes sense for an electric circuit to be either ON or OFF, so this logic and number system will be with us as long we use electricity. It's important to understand because computers and other electrical devices are a bigger part of our lives than ever now. If you understand binary, you understand the fundamentals behind the functionality of your cell phone, music stored on your MP3 player, or the programming in your TV remote control.

The most important lesson you can learn is that electric circuits, represented by 1s and 0s, can create ANYTHING you could imagine. Isn't that pretty neat?

Want to return to the normal guide? Click here!

All Content Copyright ©Dan Kennedy; 1998-2005