Codes and computers (lesson plan for Cub Scouts)

Created by Lincoln Cushing, for Berkeley Cub Scout Pack 30, 1/10/2000, Binary and ACSII

Codes are a helpful method for helping to transmit information clearly across distances. Morse code and semaphore are examples scouts are familiar with.

Morse code only requires the use of two items (or states) of information, a dot and a dash. As long as we can let the receiver know when one letter ends and another begins, the entire alphabet can be transmitted.

Computers are also based on information that is entirely broken up into two items of information, zeroes and ones (0 and 1). This is called binary.  Humans use a mathematical system called decimal which uses “base 10”, where all numbers can be made up using 10 digits (0 through 9).  Binary is “base 2”, where all numbers are made up only using two digits, 0 and 1. Here’s how it’s done:

position 8 7 6 5 4 3 2 1
value 128 64 32 16 8 4 2 1

Just like decimal numbers, you add digits to the left to build bigger numbers. Position and value are everything. Let's build some numbers:

The first placeholder (position 1) either has a value of 0 or 1.

The second placeholder (position 2) either has a value of 2 or 0.  So, the number “10” in binary means a number  with 0 in the first position and 2 in the second position, so it really represents the number “2”.  To represent the number "3", you need to fill both first and second positions with value, so in binary it would be "11".

Here are the first several numbers in decimal and binary:

decimal 1 2 3 4 5 6 7 8
binary 1 10 11 100 101 110 111 1000

In computer language, binary items of information (0’s and 1’s) are called bits.  These are grouped into bundles of 8 to form a byte. So, every ninth bit the information starts over, and means a new letter or number, just like the spaces in Morse Code mean the start of a new letter.

Modern data uses a coding system called ASCII (pronounced “ask-ee”), for American Standard Code for Information Interchange. ASCII uses the numbers in a byte to set up a universal language to represent letters and numbers.  For example, ASCII 97 is the lower case letter “a”. ASCII 98 is “b”. This goes on up to ASCII 122, “z”.

So, if we are using a byte per letter, ASCII 97 in binary looks like 01100001; going from left to right, that’s 0 plus 64 plus 32 plus (0,0,0,0) plus 1, for a total of 97.

Here’s the lower-case alphabet in ASCII, with the binary equivalent:

a 97 01100001
b 98 01100010
c 99 01100011
d 100 01100100
e 101 01100101
f 102 01100110
g 103 01100111
h 104 01101000
i 105 01101001
j 106 01101010
k 107 01101011
l 108 01101100
m 109 01101101
n 110 01101110
o 111 01101111
p 112 01110000
q 113 01110001
r 114 01110010
s 115 01110011
t 116 01110100
u 117 01110101
v 118 01110110
w 119 01110111
x 120 01111000
y 121 01111001
z 122 01111010

A space (such as one you would use to separate words) is represented by ASCII 32, or 00100000.

Here’s a sample word in ASCII/binary; what is it in English?

01100010 _ 01100101_01100001_01110010

Den 3 challenge:

1. Divide into two groups.

2. Agree on a 15-word (including spaces) sentence you want to send to a friend, and write it out in ASCII/binary.

3. When both groups done, exchange coded messages and see who can decode the sentence first.

TOP SECRET

SECURITY CLEARANCE REQUIRED

1___ ___ ___ ___ ___ ___ ___ ___ = __

2___ ___ ___ ___ ___ ___ ___ ___ = __

3___ ___ ___ ___ ___ ___ ___ ___ = __

4___ ___ ___ ___ ___ ___ ___ ___ = __

5___ ___ ___ ___ ___ ___ ___ ___ = __

6___ ___ ___ ___ ___ ___ ___ ___ = __

7___ ___ ___ ___ ___ ___ ___ ___ = __

8___ ___ ___ ___ ___ ___ ___ ___ = __

9___ ___ ___ ___ ___ ___ ___ ___ = __

10___ ___ ___ ___ ___ ___ ___ ___ = __

11___ ___ ___ ___ ___ ___ ___ ___ = __

12___ ___ ___ ___ ___ ___ ___ ___ = __

13___ ___ ___ ___ ___ ___ ___ ___ = __

14___ ___ ___ ___ ___ ___ ___ ___ = __

15___ ___ ___ ___ ___ ___ ___ ___ = __

 

return to linkspage>