Translating Text and Numbers to Decimal Code and then Binary
Now that the children are experts at converting binary numbers to decimal (binary number 1011 is the decimal number 11) and converting decimal numbers to binary (decimal number 65 is 1000001), they can now learn what computers actually do. That is converting text, numbers, punctuation, and commands to binary. This is a two step process. First you need to convert each letter (or character or number) to its decimal equivalent using an ASCII (American Standard Code for Information Interchange) chart. ASCII charts are readily available, but the capital letter A is represented by the number 65 and the lower case a is represented by 97. Each subsequent letter is one number higher than its predecessor, i.e. B is 66 and b is 98, etc. For punctuation, referencing an ASCII chart or using the spreadsheet method is recommended.
Using this method, we will convert the phrase, "Hello World" to decimal. Counting up from 65, we know that the letter H is represented by the decimal number 72. Using the same method, we can convert the rest of the words to decimal. Using an ASCII chart, you will find that the decimal equivalent to a space is the number 32. In this way, we can convert the phrase “Hello World” to the decimal version, which is, "72 101 108 108 111 32 87 111 114 108 100.”
Next we need to convert the decimal to binary. Converting text to binary requires converting each letter or character in the text version to its binary equivalent and then converting that number into its binary form. To close out with our "Hello World" example, the binary for that sentence is as follows:
01001000 01100101 01101100 01101100 01101111 00100000 01010111 01101111 01110010 01101100 01100100
Notice how each binary number has 8-digits. Since the computer can only recognize commands from 1s and 0s, it needs to distinguish one command from another. It does this by reading each command as an 8-digit binary number. So even if the binary is 100000 for the decimal code 32 (for a space), it is only 6 digits so we have to add two zeros before the number to the left as 00100000. If you add the zeros on the right, it changes the binary code by multiplying it by two for each zero (please be careful not to make that mistake).
The attached pdf called “ASCII Characters and Text to Binary and Decimal” will allow the children to convert each letter (upper an lower case), each numeric digit, each punctuation (.,/;:!@#$%&*()-_=+ and so on), and each command into a decimal code. One of the pdfs also does the binary conversion; the more challenging one does not. The K-1st graders should use the one that does the binary conversion. The 2nd graders and up should challenge themselves to do the conversion on their own.
The best way to do this is to start with your first binary conversion like decimal code for the letter T is 84; the binary is 01010100. If you also have a capital U with decimal code 85, you can just add a one by turing on the right-most digit to 01010101. Adding a number that already has a turned on power of two is more challenging since you first have to subtract before you can add.
On the first pdf, the last page is a worksheet for the children to create their own sentence (complete with punctuation), then find each decimal ASCII code, and finally, convert each decimal to an 8-digit binary number. They key here is for them to look at the corresponding cell. The worksheet is organized into 30 characters (five columns and six rows). So if they have a letter "r" in their text in the fourth column, row two, the decimal code 114 should go in the fourth column, row two in the middle of the worksheet and the binary 01110010 should go in the fourth column, row two on the bottom of the worksheet.
Attachment | Size |
---|---|
Binary_from_Decimal_ASCII_Code_from_Text.pdf | 40.27 KB |
ASCII_Characters_and_Text_to_Binary_and_Decimal.pdf | 61.38 KB |
ASCII_Characters_and_Text_to_Decimal.pdf | 58.15 KB |