How denary numbers are represented in computer systems. Introduction to Hexadecimal as an abbreviation of binary. It is required by all examination boards.
We are learning ...
So that we can ...
Everything on a computer is a code. Numbers, letters, symbols, images, sounds. In order to encode data, we use binary. A system of binary encoding can be used to represent any number of different (and often related) items of data. The number of binary digits used in each code determines the number of different items of data that can be represented.
To use binary encoding to represent the directions of a rocket, I could use a 1-bit encoding table ...
To use binary to encode the direction of movement of a game character, I could use a 2-bit encoding table ...
We use as many bits to encode data as we need to ensure that there are at least enough combinations available for encoding. Sometimes, this means that we have some codes left unused, but that's OK.
Task 1.1 Encoding systems
Where we learn how you can 'encode' data using binary for different purposes
Answer the following questions in full sentences in your notebooks.
Explain to Erik how these encoding systems work. How do you decide how many bits you need to use to encode a certain collection of things and what do you do with the codes left over?
Task 1.2 Character encoding system Where we make your own character encoding system using coloured cards
There are 26 letters in the English alphabet therefore, you need at least 5 bits to encode it. This actually gives you 32 possible combinations - only 26 are needed and therefore, there are 6 left over unused ...
Download the '5 Bit binary character encoding' document (your teacher may give you a copy) and use this to communicate in code with another student. You will need to ask your teacher for a set of encoding cards.
Explain to Erik what you have found out by writing a description of the task you have just done in your notebooks or on paper in your folders.
With a 5-bit encoding system, you can represent the letters of the alphabet plus a couple of symbols and control characters. We can't represent upper and lower case characters or numbers using this system however because we haven't got enough codes available.
Task 2.1 The ASCII encoding table
Where we learn about the ASCII character encoding system
ASCII stands for 'American Standard Code for Information Interchange'. It was designed to standardise the encoding table for characters across the whole world!
Print out the following popup and stick it in your books (or ask your teacher for a copy). There is a lot of information on this sheet - your teacher will guide you through it. CHANGE THIS DIAGRAM _ HEADINGS ARE WRONG Find the binary code for your first initial in ASCII. With 8 beads, colour in the '1' beads and leave the '0' beads natural. String them on a 'necklace' for your own geeky jewellery!
What is my first initial?
Now complete the following tasks, writing your answers in your notebooks in full sentences.
Task 2.2 Patterns in the codes Where we look for patterns in ASCII codes - there are lots!
ASCII is a binary encoding system. In the table in Task 2.1, I've also given the character a decimal code to make it easier for you to write down the codes and, as we'll see later, these decimal codes are used in programming as well.
The character ranges in the ASCII table have a special significance which is not entirely obvious looking at the numerical codes. Carry out the following activities, recording what you have done in your notebooks. For each activity, you will need to create a table with the following headings (I've put sample content in to show you what to do) ...
Find the numbers 0 to 9 on the ASCII encoding table you have in your notebooks / folders. Make a table using the format above containing the 8-bit binary ASCII codes for the numbers 0 to 9.
Look carefully at the codes - can you see a pattern? (HINT : there is one!) Write about what you see.
Make two tables side-by-side, one for lowercase letters and one for uppercase letters. Look carefully at the 8-bit binary codes - can you see a pattern? (Hint : there is one!) Write about what you see.
Where we learn how to use ASCII codes in Python programming
Type the following instructions at the console, pressing Enter after each one ...
>>> print(chr(70)) >>> print(ord('F')) Write about what happened in your notebooks and try to explain to Isaiah what the
chr() and ord() commands do. What use are these? Try typing the following commands at the prompt ...>>> print(chr(ord('h')-32)) >>> print(chr(ord('T')+32)) >>> print(ord('4')-48) Can you explain to Isaiah what these code snippets are actually doing? HINT : Use your ASCII table to help you!
In a Python Script
Download the script, save it to a suitable place in your documents. Find the script, right click it and choose 'Edit with IDLE' and press F5 run it in your Python programming environment. The scripting window will appear and the script will run although it will look as though nothing has happened.
Now type the following commands exactly in the console, pressing Enter after each one.
>>> ASCIIToString([72,101,108,108,111,33]) >>> StringToASCII('Goodbye!') Inspect the two functions in the script and try to figure out how each one works. Write your ideas on the 'Explaining the functions' worksheet, print it and give it to your teacher (or Isaiah if you can find him).
With pure 7-bit binary encoding, the 8th bit of the byte can be used for an error checking system called 'parity'. However, we could use it for more character encoding.
Task 3.1 Extended ASCII
Where we learn what difference an extra bit makes in a character encoding system
Attempt the following activities. Where necessary, write the answers in your notebook.
Where we learn about the third and most modern character encoding system that has nothing to do with unicorns
Even 8 bits is not enough for some languages! Greedy! Visit the website shown in the presentation and take a little time to look through some of the Unicode code charts (they are PDF documents and may need downloading).
Attempt the following exercises, recording your responses in your notebook where possible.
Click to load key word list to help you make your own flash cards
Baudot code
Do some web research into Baudot code and write about what you have found out. If you like Coldplay, take a look at the following website and read about the X&Y album cover here. Can you find a 'baudot tape' which has the same encoding system as the X&Y album cover image?
Websites worth a read Crack on and learn a bit more!
|