Computers contain millions of transistors—microscopic electronic switches that turn on and off millions of times a second to create the computer experience you're having right now. To process the words, images and sounds we use every day, computers and other devices (such as CD players) transform these communications into a simple code that uses the numerals 0 and 1 to represent the on and off states of a transistor. This language of 0s and 1s is known as digital information. As simple as this language may seem, it is extremely versatile and has played a major role in the greatest technological revolution the world has ever seen.
Lesson 1: What Is Binary Code?
People use all kinds of symbols, sounds, colors and body motions to express themselves. These expressions are, in a sense, codes—signals we use to communicate with one another.
Computers use a special code of their own to express the digital information they process. It's called the binary code because it consists of only two symbols—0s and 1s. (The "bi" in "binary" means two.)
Why 0s and 1s? Because those are the only two numbers you need to express the flow of electricity through a transistor. It's either on or it's off. On is 1, off is 0. Everything you say to a computer has to be put in terms of these two numbers.
Lesson 2: A Bit of This and That
For a computer to execute or respond to a command, it has to be translated into the only language a computer knows: The 0s and 1s of the binary number system. The 0s and 1s represent the on and off of the transistors.
What do you call one of these 0s or 1s? A bit. Which makes sense when you see how many of these bits it takes to represent a word, number, color, graphic or sound. They really are just a "bit" of something bigger.
Lesson 3: How Computers Work with Pictures
Picture this. A computer is made up of millions of electronic switches (transistors). They're either on or off, open or closed.
Now picture this. Your computer screen has hundreds of thousands of dots arranged in rows and columns. Each dot is a picture element or pixel. Each of these pixels displays some combination of red/green/blue according to a device called a Video Graphic Array (VGA). The VGA translates binary-coded information (0s and 1s) into the color combinations required to make up an image on your computer screen.
How Computers Work (and Play) with Pictures
Think of the grid on the right as a simplified view of a black-and-white computer screen. Each grid square represents a pixel. Naturally, they're much bigger than the real thing. Doing this activity will show you how an image can be portrayed with just two instructions: On and off.
The binary system that computers use to store and process information is a base 2 system. It needs only two symbols, 0 and 1. In fact, "binary" comes from the Latin word for two. Compare this to the decimal system you use. The decimal system is a base 10 system. ("Decimal" comes from the Latin word for ten.) It has 10 symbols (0, 1, 2, 3, 4, 5, 6, 7, 8, 9).
So how do you count in a binary system? How do you represent numbers like 103?
In decimal (base 10) numbers, you have a 1s place, a 10s place, a 100s place, and so on, to represent value.
The binary system has places or columns too. Only because you're in base 2, instead of each place being 10 times greater than the place before it, each place is only double (2 times) the one before it.
You know what 1 + 1 is, right? Well, what's 12 + 12? (The small 2 at the end of each 1 lets you know it's a binary number.) The answer? It's 102 (the binary number for 2).
Adding binary numbers is pretty easy. The key is carrying the 1, just like you do in decimal (base 10) system addition. Know how you carry a 1 over to the next place column every time two decimal numbers in a place column add up to 10 or more? Adding two binary numbers is just like that too. You carry a 1 over to the next place column every time you add 12 + 12 in a place column—leaving a 0 in that place column. Add three 12 numbers in the same place column and you carry a 1 and leave a 1 in the column.
Bits, the 0s and 1s of binary code, can be used in many different ways to represent information. To make it easier for computers to communicate with each other, a standard language has been created: ASCII (American Standard Code for Information Interchange).
ASCII is an 8-bit code. It uses eight bits to represent a letter, number, or punctuation mark. For instance, a lower case "a" is represented by 0110 00012. The word "cat" would be:
You make decisions every day. Like what movie to see. Or the fastest way home from school—bus, bike, or your own two feet. These are called OR situations. You can only select one of the available options at a time. A car or a bike, but not both.
Life is also filled with AND situations. Such as trying to get both your homework and your chores done so you can go to the movies with friends. In this case, both have to be done if you want the result (being able to go to the movies).
Remember the definition of binary? It means anything that has only two states. It could be:
The numerals 0 and 1 in base 2
The conditions of on and off in a transistor
The answers yes and no to simple questions
When programmers write software, they frequently use AND and OR statements to determine a result. The word AND requires both conditions to be true (in other words, a yes) for the result to happen.
The word "OR" requires either the first or the second statement to be true (a yes) for the result to happen. If you think of "yes" as a 1 and no as a 0, you can begin to see how the answers to these statements can actually be computed by a transistor. For instance, remembering that in an AND statement both conditions have to be a "yes" or a "1" for the result to be a "yes" or a "1", the following would mean you don't get to go to the movies:
Compare this to an OR statement. In this case, you would get to go to the movies if only one condition was answered with a "yes" or "1".