lesson4.3 u4 l1 hexadecimal representation

26
L.O: STUDENTS WILL LEARN TO READ HEXADECIMAL REPRESENTATION 25-50 minutes (about 1 class period) DO NOW: READ Unit 4 Lab 1: Number Representation, Page 3

Upload: lexume1

Post on 21-Feb-2017

23 views

Category:

Education


4 download

TRANSCRIPT

Page 1: Lesson4.3 u4 l1 hexadecimal representation

L.O: STUDENTS WILL LEARN TO READ HEXADECIMAL

REPRESENTATION25-50 minutes (about 1 class period)

DO NOW:READ

Unit 4 Lab 1: Number Representation, Page 3

Page 2: Lesson4.3 u4 l1 hexadecimal representation

Typing long strings of ones and zeros is inconvenient very prone to error.

Its easy to make a mistake writing all those ones and zeros for binary!

Using Hexadecimal (base 16) is a common

compromise

Four binary digits are used to represent the values 0 through 15.

Only one hex digit is needed to represents 0 through 15.

So eight digits of binary can be translated into two digits of hexadecimal, which is

much easier and much less error-prone for humans.

Page 3: Lesson4.3 u4 l1 hexadecimal representation

27 26 25 24 23 22 21 20

128splace

64splace

32splace

16splace

8splace

Foursplace

Twosplace

Onesplace

Eight bits in base two…..

…is two digits in base 16161 160

Sixteens place Ones place

Page 4: Lesson4.3 u4 l1 hexadecimal representation

For example: 12110 = 011110012 = 7916

0 1 1 1 1 0 0 1

7 9

Page 5: Lesson4.3 u4 l1 hexadecimal representation

In base 16, there are sixteen digits (0-9 and A-F)….

..Each place is worth sixteen times the place to its right.

One hex digit has 16 possible values, the equivalent of four binary digits (bits).

Page 6: Lesson4.3 u4 l1 hexadecimal representation

By convention, place value notations use only one digit in each place. We need to represent 0 through 15, and we have digits for 0-9, so we choose

A-F for the remaining values:

10 11 12 13 14 15A B C D E F

Page 7: Lesson4.3 u4 l1 hexadecimal representation

For You to Do:1. Watch this Hexadecimal and Binary Timer Snap!

program run. The top row counts in binary, the middle in decimal, the bottom in hex. Write a description of the hex counter's behavior

binary

decimals

hex

Page 8: Lesson4.3 u4 l1 hexadecimal representation

Reading Hexadecimal

• Base 16 uses powers of sixteen instead of powers of two or ten.

• Place values in hexadecimal represent the units place (160 = 1)

• the sixteens place (161 = 16)• the two hundred fifty-sixes place (162 = 256)• the four thousand ninety-sixes place (163 = 4096),

etc. So, for example:

3B16 = 3 × 161 + 11 × 160 = 48 + 11 = 5910

Page 9: Lesson4.3 u4 l1 hexadecimal representation

Hex to base 10.To translate from hexadecmial (like 7B3 16 ) to base 10:1. first, write the digits on paper. 2. Then write out the hexadecimal place values.3. start at the right with 1,4. then write 16 in the next place to the left, 5. then write 256 (which is 162), and so on.Each new place will be worth 16 times the one to its right. 7 B 3

256 16 1

This means: 7B3 16 =

7 256 + 11 16 + 3 1 = 1792 + 176 + 3 = 1971⋅ ⋅ ⋅ 10

Page 10: Lesson4.3 u4 l1 hexadecimal representation

A-F cover the digits after 9:

10 11 12 13 14 15

A B C D E F

Page 11: Lesson4.3 u4 l1 hexadecimal representation

Sample problem HEX into decimals

FF16

FF16 =

= (15 16⋅ 1 + 15 16 ⋅ 0) 10 = (15 16 + 15) ⋅ 10 = 255 10

Page 12: Lesson4.3 u4 l1 hexadecimal representation

Translate these hexadecimal numerals into base 10 notation: show your work

a.AF16

b.5D16

c.1816

d.3E816

Page 13: Lesson4.3 u4 l1 hexadecimal representation

Translate these hexadecimal numerals into base 10 notation:

a.AF16

b.5D16

c.1816

d.3E816

a.AF16 = 17510

b.5D16 = 9310

c.1816 = 2410

d.3E816 = 100010

Page 14: Lesson4.3 u4 l1 hexadecimal representation

Translate these decimal numbers into hex: show your work

a.5510

b.23610

c.200010

d.7510

Page 15: Lesson4.3 u4 l1 hexadecimal representation

Is “11” the number eleven (in decimal)?Or three (written in binary)?

Or is it seventeen ( written in hex)?

• A numeral like 11 could mean eleven in the usual decimal notation.

• or three if it is a binary numeral• or seventeen in hex notation.• The only way you know that the ”11” doesn't mean eleven is that you have write the base:

11 base 16 or just 11 16

• (By convention, the base itself is always written in decimal notation.)

Page 16: Lesson4.3 u4 l1 hexadecimal representation

Writing Hexadecimal:translating decimals (base 10) to Hex (base 16)

To translate from base 10 (like 29910 ) to base 16:• first write out the hex place values by multiplying by

16 moving left from the units place until you get to a value larger than your number (4096 for this example).

• Then think, "My number is smaller than 4096, so I leave that place blank. But I can subtract a two hundred fifty-six once, so I write a 1 there,

• and there's 43 left. Now, I can subtract 2 sixteens,• and there's 11 left. And 11 is B in hex.

Page 17: Lesson4.3 u4 l1 hexadecimal representation

29943110

4096 256 16 1

1 2 11 (B)

Now, read the number off: 12B16 =299 10 .

Page 18: Lesson4.3 u4 l1 hexadecimal representation

Translate these decimal numerals to hexadecimal notation:

a.59b.144c.229d.316

a.5910 = 3B16

b.14410 = 9016

c.22910 = E516

d.31610 = 13C16

Page 19: Lesson4.3 u4 l1 hexadecimal representation

Translate these decimal numerals to hexadecimal notation:

a.59b.144c.229d.316

Page 20: Lesson4.3 u4 l1 hexadecimal representation

Translate these decimal numerals to hexadecimal notation:

a.3B16

b.E516

c. 9016

d.13C16

Page 21: Lesson4.3 u4 l1 hexadecimal representation

Learning Objectives:

• LO 2.1.1 Describe the variety of abstractions used to represent data. [P3]• LO 2.1.2 Explain how binary

sequences are used to represent digital data. [P5]

Page 22: Lesson4.3 u4 l1 hexadecimal representation

Enduring Understandings:

•EU 2.1 A variety of abstractions built upon binary sequences can be used to represent all digital data.

Page 23: Lesson4.3 u4 l1 hexadecimal representation

Essential Knowledge:

1. EK 2.1.1A Digital data is represented by abstractions at different levels.

2. EK 2.1.1B At the lowest level, all digital data are represented by bits.

3. EK 2.1.1C At a higher level, bits are grouped to represent abstractions, including but not limited to numbers, characters, and color.

4. EK 2.1.1D Number bases, including binary, decimal, and hexadecimal, are used to represent and investigate digital data

Page 24: Lesson4.3 u4 l1 hexadecimal representation

Essential Knowledge:• 5. EK 2.1.1E At one of the lowest levels of

abstraction, digital data is represented in binary (base 2) using only combinations of the digits zero and one.

• 6. EK 2.1.1F Hexadecimal (base 16) is used to represent digital data because hexadecimal representation uses fewer digits than binary.

• 7. EK 2.1.1G Numbers can be converted from any base to any other base.

• 8. EK 2.1.2A A finite representation is used to model the infinite mathematical concept of a number.

Page 25: Lesson4.3 u4 l1 hexadecimal representation

Essential Knowledge:

• 9. EK 2.1.2B In many programming languages, the fixed number of bits used to represent characters or integers limits the range of integer values and mathematical operations; this limitation can result in overflow or other errors.

• 10.EK 2.1.2C In many programming languages, the fixed number of bits used to represent real numbers (as floating point numbers) limits the range of floating point values and mathematical operations; this limitation can result in round off and other errors.

Page 26: Lesson4.3 u4 l1 hexadecimal representation

Essential Knowledge:• 11. EK 2.1.2D The interpretation of a binary sequence

depends on how it is used.• 12. EK 2.1.2E A sequence of bits may represent

instructions or data.• 13. EK 2.1.2F A sequence of bits may represent different

types of data in different contexts.• 14. EK 6.2.2J The bandwidth of a system is a measure of

bit rate—the amount of data (measured in bits) that can be sent in a fixed amount of time.

• 15. EK 6.2.2K The latency of a system is the time elapsed between the transmission and the receipt of a request.