First, binary code is also known as Base Two (bi means two, as in Bicycle or Bilingual). Computers use Base Two because all of the work is done by transistors; tiny switches with no moving parts. The switches can either be OFF (0) or ON (1). Check out the power switch on your appliances at home. Many of them will show 0 and 1 (off and on). Learning Base Two is easy and fun. In order to proceed, you must first understand how number systems work. There are basically two rules:
1. There are "x" numerals.
2. Each place value is "x" times larger than the one to its right.
Let's take a quick look at Base Ten, the number system that we use in daily life.
1. There are ten numerals. 0123456789
2. Each place value is ten times larger than the one to its right. thousands hundreds tens ones
The largest numeral that can be put into a place is 9. If you want to get bigger, you have to move over to the next place value. (That's why, in Base Ten, you can multiply a number by 10 just by adding a 0. You are moving everything over 1 place)
All number systems work this way. Duh. If you are 13 years old, you are really 1 ten and 3 ones. But you knew that.
In Base Two, things work like this:
1. There are two numerals. 01
2. Each place value is two times bigger than the one to its right. eights fours twos ones
The largest numeral that you can put into a place is 1. If you want to get bigger, you have to move over to the next place value.
If you are 13 years old (Base Ten), you would be 1101 in Base two; 1 eight, 1 four, 0 twos, and 1 one. Add them. If you think this is weird, be glad that you are not 101110 like me! Here's what the place values look like to a computer. Each place value represents a switch (on or off). Each one is called a bit, and the computer reads them in packs of 8 (byte).
Did you notice that the place values go up like the newest version of Nintendo or Sega? This is not an accident; they read binary also! A byte that contains the number 13 would look like this: 00001101
To convert a Base Ten number to Base Two, first make a place value guide to keep you from getting lost.
Let's convert the number 46. First, determine what would be the biggest switch (place value) that you could turn on without going over? That's correct: 32. Now, put a 1 in the 32s place to turn on that switch.
Now, 32 has been used up, so how much is left? 46-32=14 So, what is the next biggest switch (without going over, remember) that we can turn on? That's right, the 8 switch!
How much is left? 14-8=6 The next biggest switch we can turn on is the 4s switch.
How much is left? 6-4=2 We turn on the 2s switch.
What's left? 2-2=0 There is nothing left, so fill the remaining places with 0 (off).
So, the number 46 looks like this as a byte: 00101110
Not sure is it is correct? Add up the places that are turned ON. 32+8+4+2=46
Whew! Remember when I said it was really very simple? I didn't say it was fast! The processor in the computer, however, can read millions of switches in a second. Not smart, but fast.
Print yourself up a Binary Worksheet and use it to change the following numbers to binary (Base Two). Write your zero's and one's right on the sheet.
What happens when you press a key on the keyboard? How does the computer know what to display when all it can read are zeroes and ones?
The computer knows an assigned number for every key! The assigned numbers are called ASCII Code, which stands for American Standard Code for Information Interchange. For this lesson, we will only use the codes that stand for the capital letters of the alphabet. The letter A is assigned the number 65, and each letter goes up by one until Z, which is 90. We will also need to use a SPACE, and the SPACE BAR key on the computer is assigned the number 32. Here's a table to show the values:
If you type the letters for LA JOYA , the ASCII code would be 76,65,32,74,79,89,65
Remember how we converted Base Ten to Base Two? Now convert the code numbers to binary for the processor to read.
Place value of the binary switches
Now, try to convert your name to ASCII, then to binary, using the worksheet. Print the page and turn it in to Mr. Dolloff
Want to know all of the ASCII values? View them at http://www.jimprice.com/ascii-0-127.jpg