Lesson Plan Industry Sector
Engineering & Design

## B6- Counting by 16's- How We Talk to Computers

### Lesson Plan Overview / Details

Because computers work best working with multiples of 2, computer programmers often find it easier to work with alternate numbering systems that are based on powers of 2. The most used of these systems is hexadecimal, which is based on 16 digits rather than 10. To create 16 digits, programmers use the letters for the digits beyond 9. This creates much confusion, as hexadecimal numbers often appear to be words rather than numbers.

Total Time 2.5 Hours.

### Student Objectives / Goals

Students will be able to recognize and properly understand hexadecimal numbers and hexadecimal notation.

### Student Objectives / Goals

• Students will be able to properly understand and use hexadecimal numbers and hexadecimal notation.
• Students will be able to convert between decimal and hexadecimal numbers.
• Students will understand why hexadecimal numbers are used in programming when they are used.

### Activities in this Lesson

• Hook Activity 15min - Hooks / Set

Play the video “I See Dead People”.  It is a clip from the movie “The Sixth Sense”. After the video, write this riddle on the board—

If you wish to add a little humor, you can go to the site www.ThinkGeek.com and buy a T-shirt with the riddle on the front and the answer on the back (57006). Just be sure if you wear the T-shirt, don’t turn around and let them see the answer before you want them to know it!

If you have never seen this riddle before, the point of the riddle is to think of the word “dead” as a hexadecimal number which is 57005, then add 1 for yourself to get 57006.

Do not give the students the answer to this riddle right away, as we will use it later in the lesson.

• Lecture 30min - Lecture

Computers think in numbers that are multiples of 2, especially 2 (binary), 8 (octal), and 16 (hexadecimal).

Binary is the base language of computers, since that is how they think as ones and zeroes (on and off), but for us to understand what they are saying it is best if we work using octal or even hexadecimal, since these are numbers large enough to comprehend.

Octal was used in early systems, but hexadecimal is preferred now since a hexadecimal number can be used to represent four binary digits. Put two hexadecimal digits together, and you have an eight-bit byte, which makes it easy to write computer code in hexadecimal format.

The problem with hexadecimal is that we only have 10 digits to work with using the decimal system- 0,1,2,3,4,5,6,7,8,9. For hexadecimal, we need six more digits! Where will we get them? Ask the students to brainstorm with you and come up with some new “digits” to use for hexadecimal numbering. You can use stars, hearts, clovers— whatever you want! Write them on the board.

Now ask the students how you would go about entering these new “digits” into a computer. Whoops! There aren’t any keys for them. Explain to the students that this is why computer programmers decided to use the letters A, B, C, D, E and F as the extra digits.

Show the video clip “Bits and Bytes”at this point.

Explain that the problem with using letters for numbers is the confusion it causes when it is difficult to tell whether they are numbers or words. This is why computer programmers begin a hexadecimal number with the prefix 0x, such as 0x4BC3. There are other designations for hexadecimal numbers, but 0x is the most used.

Show the video “What is Hexadecimal”to reinforce the concepts

• Have the students take out a piece of paper, put their name in the upper right corner and title the paper “Hexadecimal Numbers Lab”. Have them number from 0 to 15 down the page, move over about a fourth of the page and number from 16 to 31, move to the middle of the page and number from  32 to 47, move to the last fourth of the page and number from 48 to 63. Demonstrate on the board how to count in hexadecimal from 0 to 31. Have them follow you and then finish the rest of the numbers through 63.

Explain to the students how place values work in hexadecimal. Compare hexadecimal to the decimal system and explain how even as the decimal system has place values based on multiples of 10, the hexadecimal system has place values based on multiples of 16. So as the decimal system uses place values of 1, 10, 100, 1000, 100000, hexadecimal uses place values of 1, 16, 256, 4096, 65536 and so forth.

Now point out to them that the letters used in hexadecimal truly are numbers, not letters. Point out that A=10, B=11, C=12, D=13, E=14, F=15 in hexadecimal.

Ask the students if they have figured out what the joke is in this statement. If they have not figured it out, point out to them that the word “dead” in this riddle represents a hexadecimal number. Go through the process with them of converting the hexadecimal number “DEAD” into a decimal number. Have them follow along by copying what you put on the board onto their lab write-up.

Since the first place is just the 1’s place, and D=13,

13 x 1 = 13

The second place is the 16’s place, and A=10, so

10 x 16 = 160

The third place is the 256’s place and E=14, so

14 x 256 = 3584

The fourth place is the 4096’s place and D=13, so

13 x 4096 = 53248

13 + 160 + 3584 + 53248 = 57005

Add 1 for yourself, and you get:

57006

If you are wearing the T-shirt, turn around so they can see the back!

• Check Understanding 15min - Check Understanding

There is a second part to this riddle. Write it on the board and see if the students can figure out its meaning:

“Let’s say only you and dead people can read hex. If you teach your buddy how to read hex also, what do you all have in common?”

Answer: Together, you are all deaf.

Solution: If DEAD = 57005, then 57005 + you + buddy = 57007, which is DEAF in hexadecimal.

You also can show them this other popular T-shirt attached below

• Guided Practice 15min - Guided Practice

Have the students turn their paper over and number from 1 to 10. Challenge them to come up with 10 hexadecimal “numbers” that spell words. Caution them not to use unacceptable words like swear words if they find them. Encourage them to use regular digits as letters if necessary, like zero for the letter O and one for the letter i or L. After they are done, have them share their hexadecimal “words” with the class. Write the “words” up on the board.

Choose a selection of the hexadecimal “words” and have the students write them on their lab papers and them convert them to decimal numbers. Alternatively, you can have them trade papers and convert each other’s “words”.

If the conversion process is too much mathematically for your students, you can let them bring up the calculator function on their computers and switch it to either scientific or programmer’s mode and let them convert the numbers automatically through the calculator. In Windows, the calculator is found at:

Start => All Programs => Accessories => Calculator

Click on the view tab to change to scientific or programmer’s mode.

Computer programmers have a lot of  “in shop” humor that is rarely seen outside of their community.  Share the “ Hexadecimal Magic Numbers” paper with your students to see this humor.

• Hand out the “Decimal Hexadecimal Lab”. Have the student work independently to convert the numbers. Use your discretion as to whether they can use calculators or not. Higher level classes should not be allowed calculators.

• One of the places students are most likely to see hexadecimal outside of programming is in color coding in paint programs like Photoshop. Show the attached video, “How to Understand Hexadecimal Color Code” from Adobe Corporation to show them how this works. These same color codes are used in Web Design also, so you can make that connection if you have your students do any web design.

If you have time and access to a program like Photoshop, allow them to try these color codes out.

Here is a final hexadecimal joke. See if your students get it:

3x12=36

2x12=24

1x12=12

0x12=18

• Assessment - Assessment

Teacher should collect and grade the lab write-up and the “Decimal Hexadecimal Lab”. You also can assign points based on student observations and participation during lecture and guided practice.

Total Time
0 Hours