Zeros and Ones: Understanding Computer Language
Preparation
Grade Level: 6-9
Time: 45-60 Minutes
Group Size: 20-25
Presenters: 3
Objectives
This lesson will enable students to:
•
•
•
Explain how the computer processes language and symbols.
Practice using binary code to encode and decode written language.
Practice using binary code to encode and decode decimal numbers.
Standards
This lesson aligns with the following National Science Content Standards:
•
•
•
Unifying Concepts and Processes in Science, K-12
Science and Technology, 5-8 and 9-12
History and Nature of Science, 5-8
Materials
•
“How RAM Works” CD
•
Computer workstations
•
Binary Converter
•
•
•
•
•
•
•
On-line Binary Converter – http://www.micron.com/k12/resources.aspx
Binary Number Introduction Transparency (Appendix A)
Binary Numbers Transparencies (Appendix B)
“Binary vs. Decimal” worksheet (Appendix C)
“ASCII Table” handout (Appendix D)
“Write Your Name” worksheet (Appendix E)
“Write a Message” worksheet (Appendix F)
Revision Date:12/30/2006
1
© 2001 Micron Technology Foundation, Inc. All Rights Reserved
Preparation
Set up three stations: “How RAM Works,” Binary Numbers, and Binary Letters. For “How RAM
Works” setup as many computers as are available. Identify two other workstations appropriate
for short presentations and individualized work. Supply each workstation with the appropriate
handouts and posters.
Revision Date:12/30/2006
2
© 2001 Micron Technology Foundation, Inc. All Rights Reserved
Introduction
Binary Numbers
You learned how to count when you were very young. The number system that you used is
called the decimal system. The word decimal means ten. The decimal number system has ten
symbols. The ten symbols are 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9.
With just these ten symbols you can count forever. You know that once you have used ten digits
from 0 to 9, you next create numbers with two digits such as 10, 11, 12, 13, and so on.
Next you use a combination of three digits to get 100, 101, 102, 103, and so on.
The word binary means two. The binary number system has two symbols: 0 and 1. With just
these two symbols you can also count forever.
Use the Binary Number Introduction transparency (Appendix A) to illustrate this.
0000
= 02
=0
0110
= 1102
=6
0001
= 12
=1
0111
= 01112
=7
0010
= 102
=2
1000
= 10002
=8
0011
= 112
=3
1001
= 10012
=9
0100
= 1002
=4
1010
= 10102 = 10
0101
= 1012
=5
Etc.
When we write binary numbers we use a "2" for a subscript to represent the binary system. The
poster shows the binary numbers from 1 to 10. (These numbers are read "One base 2," "Onezero base 2," and so forth.)
3
Notes on the Binary System
A "bit" (short for "binary digit") is the smallest piece of data that a computer knows. It is a single
digit, which can be a one or a zero. By combining groups of bits and manipulating them, a
computer can accomplish all the remarkable things it has a reputation for doing. Because this
grouping of bits is so important, some special names have developed.
A "word" is a group of any number of bits. A "byte" is a group of 8 bits, but it could also be
called an "8-bit word". Everybody knows that a nibble is half of a bite, so in the binary system, a
"nibble" is a group of 4 bits, or half of a byte.
Now call each binary digit a "bit." Put 8 bits together to make a byte. If you wrote down all the
different possible combinations of ones and zeros that could make up a byte, you would have
256 different combinations a way to do this is to start with 00000000 and count in binary up to
11111111.
Divide the class into three groups and point out the three workstations: "How RAM Works",
binary numbers, and binary letters with one presenter/facilitator at each workstation. Rotate the
groups through each workstation. When each group has had an opportunity to participate in
each workstation, bring them all back together for a discussion.
How RAM Works
Have computer workstations set up to allow students to review “How Ram Works.” Have each
student complete one of the three parts of the program. If time allows they may complete
more. Allow time for discussion of the program and what they learned.
How RAM Works explains RAM (Random Access Memory). It includes an explanation of
transistors and capacitors and how the Binary code applies. There are three parts to the
program, you will complete one part. Be prepared to share what you learned with the rest of
the group.
The three parts are:
•
•
•
Using an "X-ray machine" to examine the insides of a memory chip.
Discovering the language of computers and play "byte invaders."
Trying a game of concentration to see how much "RAM" you have in your short-term
memory.
Students can complete more then one part if time permits. Before the students rotate to the
next station discuss what they discovered with each part of the program.
4
Binary Numbers
Binary and decimal are two different ways to represent a quantity.
Use the binary converter to demonstrate the following concepts. Transparencies of the Binary
Numbers charts (Appendix B) may be used as well.
Reading binary numbers
In the binary number system, as in the decimal system, the value
of a digit is determined by where it stands in relation to the other
digits in a number. In the decimal system, the number 1 by itself
is worth 1; putting it to the left of two zeros makes the number
worth 100. This simple rule is the backbone of arithmetic.
Numbers to be added or subtracted are first arranged so that their
place columns line up.
In decimal notation, each position to the left of the decimal point
indicates an increased power of 10. In binary or base 2, each
place to the left signifies an increased power of two: 20 is one, 21
is two, 22 is four, and so on.
Decimal to binary conversions
To find the decimal equivalent of a binary number, add up
the value of places marked by binary 1s. Thus, binary 101
has one 4(place) plus one 1(place) to equal decimal 5. Binary
1001 has one 8(place) plus one 1(place) to equal decimal 9.
Conversion the other way—from decimal to binary—is shown
to the right.
To convert a decimal number to binary, first subtract the
largest possible power of two, and keep subtracting the next
largest possible power from the remainder, marking 1s in
each column where this is possible and 0s where it is not.
For decimal 43, there is one 32, no 16, one 8, no 4, one 2,
and one 1—resulting in the binary number 101011.
5
Adding Binary Numbers
The two groups of figures below are binary and decimal equivalents. Both sums are found by
adding down columns and carrying remainders to the left. In the first decimal column, 9 plus 9
equals 18, with the 8 written down and the 1 carried. In the first binary column, 1 plus 1
equals 10 (one-zero, not ten), with the 0 written down and the 1 carried. The next binary
column thus becomes 1 plus 1, or 10 (one-zero), plus the carried 1, for a total of 11--with the
right hand 1 written down and the other 1 carried. The figures below serve to check the binary
addition by converting the sum back to decimal.
Adapted from Computer Basics, a Time-Life Book.
6
Explain counting in binary using the following chart.
Counting in Binary
23
22
21
20
Decimal
Decimal
8
4
2
1
Count
Value
0
0
0
0
0+0+0+0
0
0
0
0
1
0+0+0+1
1
0
0
1
0
0+0+2+0
2
0
0
1
1
0+0+2+1
3
0
1
0
0
0+4+0+0
4
0
1
0
1
0+4+0+1
5
0
1
1
0
0+4+2+0
6
0
1
1
1
0+4+2+1
7
1
0
0
0
8+0+0+0
8
1
0
0
1
8+0+0+1
9
1
0
1
0
8+0+2+0
10
1
0
1
1
8+0+2+1
11
1
1
0
0
8+4+0+0
12
1
1
0
1
8+4+0+1
13
1
1
1
0
8+4+2+0
14
1
1
1
1
8+4+2+1
15
Distribute “Binary vs. Decimal” worksheet (Appendix C). Have students take turns using the
binary converter. While they are waiting, have them complete the worksheet either in pairs or
individually.
7
Binary Letters
Use the “ASCII Table” (Appendix D) to demonstrate how letters are stored using the binary code.
The “Online Binary Converter” www.micron.com/k12/resources.aspx may be used to help
illustrate the concepts in this section.
Computers work in binary. Information inside of computers is coded using 0s and 1s. In the
early years of computers different types of computers used the binary system in different ways.
The code for the letters in the word CAT was different in different brands of computers.
Eventually, a set of standards was developed. The computer manufacturers agreed to use one
code called the ASCII code. This code is used for working with letters and symbols. ASCII stands
for American Standard Code for Information Interchange.
The ASCII code is an 8-bit code. That is, it uses eight bits to represent a letter or a punctuation
mark. Eight bits are called a byte. A binary number with 8 digits, such as 110110112 can be
stored in one byte of computer memory.
ASCII Code
Decimal Number
Letter
010000012
65
A
010000102
66
B
010000112
67
C
This poster shows some of the ASCII code. The table indicates that the binary representation for
the letter A is 010000012. When two people are talking to each other, they might say, "The
ASCII code for the letter A is 65." This is easier to remember and say than the statement, "The
ASCII code for the letter A is 010000012."
The binary codes for the alphabet have been assigned in a systematic fashion. An A is decimal
65, a B is decimal 66, a C is decimal 67, and so on. This allows the computer to alphabetize
words by sorting their ASCII codes in numerical order. The machine-language instruction set in
a computer is designed to make it easy to sort numbers into numerical order.
Distribute the “ASCII Table” handout (Appendix D) to all of the students.
Each letter, number and symbol is represented by an 8-bit ASCII code. Part of the ASCII code is
given in the handout. Notice that there is even an ASCII code for a blank character.
Notice that the ASCII code for an uppercase "C" is different from the code for a lowercase "c."
8
The ASCII code for "C" is 010000112.
The ASCII code for "c" is 011000112.
They are almost the same. They differ only in the third bit from the left.
"C" decimal 67
"c" decimal 99
When a computer works with words, it is working with a collection of bytes. For example, sit at
a computer keyboard and type "CAT" into a word processor.
The three numbers 010000112, 010000012, and 010101002 are stored in the memory of the
computer. If you type "cat" instead of "CAT," the three numbers 011000112, 011000012, and
011101002 are stored in the computer memory. Remember that there are different ASCII codes
for lowercase and uppercase letters.
Use the ASCII table for the "Write Your Name," “Write a Message," and "Translate a Message"
activities.
Activity 1: Write a Your Name in ASCII
Provide copies of the “Write Your Name in ASCII” worksheet (Appendix D) for all of the students.
Write your full name – first, last, and middle initial, in both decimal and ASCII using both
uppercase letters and lowercase on the worksheet. If your entire name doesn’t fit in the table
provided, use the back of the worksheet.
Activity 2: Write a Message in ASCII
Using your ASCII table, write a one-sentence message in ASCII. Exchange your message with a
partner and decode the message. To make it easier to read, use a coma after each word and a
space after each letter or character.
Activity 3: Translate a Message in ASCII
Provide copies of the “Translate a Message from ASCII” worksheet (Appendix E) for all of the
students.
Can you translate this message from the ASCII equivalent? This code has no commas between
words, but it does have spaces and other punctuation marks written in ASCII.
9
Solution for ASCII Message
"That's one small step for a man, one giant leap for mankind." –Neil Armstrong, Apollo Mission
Another activity the students might try is using ASCII is like Charades, where students write the
name of a famous person, movie title, or book title in ASCII on the blackboard and see how fast
their team members can figure it out.
Conclusion
Once all of the students have had an opportunity to move to each station, have them return to
their desks and discuss the following with them.
Q: How did you like converting from decimal to binary?
A: Answers will vary
You can easily see that it takes many more symbols to represent even small numbers using the
binary system than it does using the decimal system. It is easier to say, "I am 14 years old" than
to say, "I am one-one-one-zero base 2 (11102) years old."
Q: Can you imagine how long it would take you to do all of your writing in binary code?
Q: How long do you think it would take the computer to translate from binary to letters?
Enter a sentence from their letter activity on the computer to see how much more quickly the
computer is able to convert from binary symbols to letters.
Computers are built to work with the binary symbols 0 and 1. People are taught to work with
the decimal symbols 0, 1, 9. People can learn to convert from decimal to binary and back again.
Computers can be programmed to convert from decimal to binary and back again. In this way,
computers and people can each work with the symbol set that best suits their purpose.
Distribute sample chips. A 256 Meg chip stores 256 million bits of
information which is equivalent to twenty 400 pages books with 500 words
per page.
10
Appendix A – Zeros and Ones
Binary Number System
0000
= 02
=0
0110
= 1102
=6
0001
= 12
=1
0111
= 01112
=7
0010
= 102
=2
1000
= 10002
=8
0011
= 112
=3
1001
= 10012
=9
0100
= 1002
=4
1010
= 10102 = 10
0101
= 1012
=5
Etc.
11
Appendix B – Zeros and Ones
Reading Binary Numbers
Decimal to Binary Conversions
12
Appendix B – Zeros and Ones
Adding Binary Numbers
Counting in Binary
23
22
21
20
Decimal
Decimal
8
4
2
1
Count
Value
0
0
0
0
0+0+0+0
0
0
0
0
1
0+0+0+1
1
0
0
1
0
0+0+2+0
2
0
0
1
1
0+0+2+1
3
0
1
0
0
0+4+0+0
4
0
1
0
1
0+4+0+1
5
0
1
1
0
0+4+2+0
6
13
Appendix C– Zeros and Ones
Binary vs. Decimal
Directions: Complete the following table as instructed.
Groups of
Decimal 16s 8s
4s
2s 1s Binary
0
0
0
0
0
0
02
1
0
0
0
0
1
12
2
0
0
0
1
0
102
3
0
0
0
1
1
112
4
0
0
1
0
0
5
0
0
1
0
1
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
14
Appendix D – Zeros and Ones
ASCII Table
Use this table for writing your name and messages in ASCII.
15
Appendix E – Zeros and Ones
Write Your Name in ASCII
Using your ASCII table, write your full name (first, middle initial and last) using ASCII. Use both
upper and lower case letters as appropriate. Don’t forget spaces and a period. Use one letter
per row, if you run out of room continue on the back side of the paper.
16
Appendix F – Zeros and Ones
Translate a Message
Translate this message from the ASCII equivalent. The code includes spaces between words
and uses other punctuation mark.
17