The Journey Inside℠, an Intel® Education program.
Lesson 1: What Is Binary Code?
People use all kinds of symbols, sounds, colors, and body motions to express themselves. These expressions are like codes or signals we use to communicate with one another.
Computers use a special language of their own to express the digital information they process. It’s called the binary code, bi meaning two, because it consists of only two symbols—0s and 1s.
So why 0s and 1s? Because those are the only two numbers you need to express the flow of electricity through a transistor. A transistor is either on or off; on is 1, and off is 0. Everything you say to a computer has to be put in terms of these two numbers.
Lesson 2: Binary Digit (Bit) and Machine Language
For a computer to execute or respond to a command, it must 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.
We call one of these 0s or 1s a bit. Just like how words are made of several letters, computers create numbers, colors, graphics, or sounds with 0s and 1s. They really are just a bit of something bigger.
Lesson 3: What Is a Pixel?
Imagine a computer that is made up of billions of electronic switches (transistors). They’re either on or off.
Now imagine this. Your computer screen has hundreds of thousands, if not millions, of dots arranged in rows and columns. Each dot is a piece of a picture—otherwise known as a pixel—and the number of pixels used is called the resolution. The higher the pixel count, the higher the resolution, and the better the picture quality. For example, a high-definition 1280 x 720p resolution screen means the screen would have a width of 1,280 pixels and a length of 720 pixels. That’s 921,600 total pixels!
Each of these pixels display some combination of red, green, and blue to create colors. Computers operate by mixing these three colors to create black, white, and millions of other color combinations.
For your next activity, think of the grid as a simplified view of a black-and-white computer screen. Each grid square represents a pixel. In these activities, the squares are much bigger than the real thing, but doing this activity will show you how an image can be portrayed with just two instructions: on and off.
Try lesson 1: Work and play with pictures.
Try lesson 2: Pixel pictures.
Lesson 4: Binary Numbers
The binary number system, which computers use to store and process information, only uses two digits: 0 and 1. In fact, the bi in binary comes from the Latin prefix meaning two. Binary is a base 2 number system. The 2 represents the number of digits the system uses.
Compare this to the decimal number system you use. The decimal system includes 10 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. Its name also tells you how many digits it includes, as dec comes from the Latin prefix meaning ten. The decimal system is a base 10 number system.
So, if you saw the number 100, how would you know if it was in base 2 or base 10?
In math, a little subscript number is added to the right-most number in a set to tell you what base system the number set is in. When you see a number written as 1002, the little 2 lets you know the set of numbers is in base 2, or binary. If you see a number written as 10010, the little 10 tells you that the set of numbers is in base 10, or decimal.
Reading Binary Numbers
Reading binary numbers is different than reading decimal numbers. In the decimal system, you read all the numbers together at once as a whole number¬—1, 10, 100. But in binary, you read the numbers like a math equation. You have to solve a math problem for each individual number, or bit, and then add all the individual answers together to find out what the total whole decimal number equivalent is.
For example, in decimals, 1010=10, but in binary, 102=2!
To read a binary number, first you need to look at the placement of each 1 and 0, and you always read binary numbers from right to left.
In decimal (base 10) numbers, you have a 1s place, a 10s place, a 100s place, and so on to represent value. Each place is 10 times greater than the place before it. The binary system (base 2) has places, or columns, too. As binary only has two numbers, each place is worth double (two times) the one before it.
Binary places also have slightly different names. The right-most value in a binary number is your starting value, and it is in the “zero place.” The next place to the left is considered the “first place” because you’ve moved one spot from the start. The next place to the left after that is the “second place” because it is two spots over from the start.
Why does the place of the number matter?
Let’s look at an example, the binary number 1002.
- Starting at the right with the zero place, we see the number 0, which is also worth 0.
- Moving one place to the left (the first place), we see another 0. If we double 0, we still get a value of 0, as 0x2=0.
- Next, we move one more place to the left (the second place), and we see a 1. Since the 1 is two spots away from the start, to determine its decimal value, we have to double its value twice: 1+1=2, then 2+2=4. So, in binary, the 1 in 1002 is worth 4.
- Finally, we add the values of all three binary numbers together to find out the total whole decimal equivalent: 4+0+0=4. Therefore, 1002 is the same as decimal number 4, or 410.
Tips for converting binary numbers to decimal numbers:
- Read binary numbers like a math equation.
- Treat each number like its own math problem. Once you’ve solved each individual math problem, add all the individual answers together to get the answer.
- In binary, a number doubles its value each time it moves a place to the left. The place of the bit, the 1 or the 0, tells you how many times you need to double the number.
- Always read binary numbers from right to left.
Try lesson 1: Finding decimal and binary number equivalents.
Try lesson 2: Converting decimal numbers to binary numbers.
Lesson 5: How to Add Binary Numbers
In lesson 4, you learned how to read a single binary number and convert it to its decimal equivalent, but what about adding binary numbers?
How would you solve this equation: 102+112=?
Let’s break the problem down into smaller steps to find the decimal equivalents.
Right away, we see a subscript 2 on the end of each number set, which tells us these are binary numbers. Now we know we have some math to do on each individual number first.
Let’s start with 102, which has two numbers: 1 and 0.
- Starting on the right, we see the number 0, which we know has a decimal value of 0.
- Next, we move to the 1. Since it is one place to the left of the starting spot, it is worth double its value, or 1+1, which equals 2.
- Finally, we add the two answers together: 0+2=2. Therefore, 102 is the same as decimal number 2.
Now, let’s look at 112.
- Starting on the right, the first number is 1, which has a decimal value of 1.
- Next, we move one place to the left and see another 1. Since this number is one place to the left of the starting point, it is worth double its value, or 1+1, which equals 2.
- Now we add the two answers together: 1+2=3. Therefore, 112 is the same as decimal number 3.
Finally, we add the sum of both sets of equations, 2+3, to get the final whole decimal answer, 5. Written in binary, the answer is 102+112=1012.
(Tip: If you want to double-check your work, look back at the lesson 4 activities.)
Converting Decimal Numbers to Binary Numbers
Now that you’ve learned how to convert a binary number to a decimal number, let’s try working in reverse.
To convert a decimal number to a binary number, we again need to think about place.
In lesson 4, we learned that for every place we move to the left of the zero place, we have to double the value from the previous place.
When trying to convert a decimal to a binary number, first we need to find the place value that is as close to but not greater than the number.
Let’s take the answer to the last example, decimal 5. If you were going to put a mark in the column with the place value closest to but not greater than 5, where would you put it? Under the 4, right!
That leaves you with 1 remaining. Where does it go? Under the 1, right!
We know that binary numbers must include either a 0 or a 1 and that there aren’t any spaces. So what goes in the open space? The number 0, right!
Now we’ve found that decimal number 5 is the same as binary number 1012.
Try the lessons: Adding binary numbers.
Lesson 6: From Binary to ASCII
Bits—the 0s and 1s of binary code—can be used in many ways to represent information. Computers communicate with each other through a standard language: ASCII (American Standard Code for Information Interchange).
ASCII is an 8-bit code, and 8 bits are called a byte. ASCII uses a byte to represent a letter, number, or punctuation mark. For instance, a lower case a is represented by 011000012. The word cat would be 011000112 011000012 011101002.
Try lesson 1: The name game.
Try lesson 2: Secret messages with ASCII.
Try lesson 3: The ASCII code chart.
Lesson 7: AND/OR Statements in Software Writing
You make decisions every day, like what movie to see or how to get home from school the fastest (by bus, bike, or by your own two feet). These are called OR situations where you can only select one of the available options at a time.
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 must be done if you want the result (being able to go to the movies).
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 to both parts) for the result to happen.
The word OR requires either the first or the second statement to be true (a yes on one part and a no on the other) for the result to happen.
If you think of yes as a 1 and no as a 0, you can see how transistors in a computer that uses binary code can understand AND and OR statements.
Here is a quick summary of what we’ve covered:
- Binary is a code that consists of the numerals 0 and 1.
- Computers contain transistors that can be either on or off.
- If 1=yes and 0=no, then binary code can answer yes or no to simple questions.
Try the lesson: Can I go to the movies?
This unit provides a short history on the computer, introduces the four major components of a computer, and compares computer “brains” with the human brain.
This unit teaches students about electricity, electric circuits, and the difference between mechanical and nonmechanical (transistors) switches.
This unit explores the differences between the decimal and binary number systems and how the information is represented and processed using binary code.
This unit investigates how microprocessors process information, demonstrates the size and the complexity of their circuitry, and explains how they are manufactured.
This unit defines the internet, then explains the World Wide Web, hypertext, URLs, packets, bandwidth, connection choices, search engines, and the need to critically evaluate the quality of the information found on the web.
This unit discusses the impact technological advances have on people’s lives, with examples from the past and current day. Several readings provide insights on ways the digital age is already affecting rate of change, and what we might expect to see in the near future.