Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lab #1 Follow-Up Unix Binary / Hexadecimal Python.

Similar presentations


Presentation on theme: "Lab #1 Follow-Up Unix Binary / Hexadecimal Python."— Presentation transcript:

1 Lab #1 Follow-Up Unix Binary / Hexadecimal Python

2 Lab #1 Follow-Up Unix Binary / Hexadecimal Python

3

4 Media Access Control (MAC) address

5 B4-D8-A

6

7

8

9 DecimalHex(adecimal) A 11B 12C 13D 14E 15F

10 B 4 DecimalHex(adecimal) A 11B 12C 13D 14E 15F

11 B 4 DecimalHex(adecimal) A 11B 12C 13D 14E 15F 11×16 + 4×1

12 B 4 DecimalHex(adecimal) A 11B 12C 13D 14E 15F 11× ×16 0

13 B 4 DecimalHex(adecimal) A 11B 12C 13D 14E 15F 11×16 + 4×1

14 B 4 DecimalHex(adecimal) A 11B 12C 13D 14E 15F 11×16 + 4×

15 B 4 DecimalHex(adecimal) A 11B 12C 13D 14E 15F 11×16 + 4×

16 All modern numbering systems work this way B 4 11× × ×16 + 4× × × × × ×10 + 0×1 180

17 Why Base 16?

18 DecimalHexBinary A B C D E F1111

19 Why Base 16? DecimalHexBinary A B C D E F1111

20 B 4 Eight Bits = One Byte DecimalHexBinary A B C D E F

21 Why Base Two?

22

23 ENIAC (1946)

24 1940s Faster, Cheaper, Smaller 1950s 1960s Today Vacuum tube RelayTransistor Integrated Circuits

25

26 ● To convert from binary to decimal Start from right Multiply 0,1 by powers of two (1, 2, 4, 8, …) Sum of these products is decimal equivalent ● E.g., = ??? 10 Binary-to-Decimal Conversion

27 ● To convert from binary to decimal Start from right Multiply 0,1 by powers of two (1, 2, 4, 8, …) Sum of these products is decimal equivalent ● E.g., = ??? 10 1 * 2 0 = 1 Binary-to-Decimal Conversion

28 ● To convert from binary to decimal Start from right Multiply 0,1 by powers of two (1, 2, 4, 8, …) Sum of these products is decimal equivalent ● E.g., = ??? 10 1 * 2 0 = 1 +0 * 2 1 = 0

29 Binary-to-Decimal Conversion ● To convert from binary to decimal Start from right Multiply 0,1 by powers of two (1, 2, 4, 8, …) Sum of these products is decimal equivalent ● E.g., = ??? 10 1 * 2 0 = 1 +0 * 2 1 = 0 +1 * 2 2 = 4

30 Binary-to-Decimal Conversion ● To convert from binary to decimal Start from right Multiply 0,1 by powers of two (1, 2, 4, 8, …) Sum of these products is decimal equivalent ● E.g., = ??? 10 1 * 2 0 = 1 +0 * 2 1 = 0 +1 * 2 2 = 4 +1 * 2 3 = 8

31 Binary-to-Decimal Conversion ● To convert from binary to decimal Start from right Multiply 0,1 by powers of two (1, 2, 4, 8, …) Sum of these products is decimal equivalent ● E.g., = * 2 0 = 1 +0 * 2 1 = 0 +1 * 2 2 = 4 +1 * 2 3 = 8 ____________ 13

32 13r 2 = 1 13 ÷ 2 = 6 6r 2 = 0 6 ÷ 2 = 3 3r 2 = 1 3 ÷ 2 = 1 1r 2 = 1 1 ÷ 2 = 0 ___________ Decimal-to-Binary Conversion To convert from decimal to binary 1.Take remainder of decimal number / 2 2.Write down remainder right-to-left 3.If decimal number is zero, we’re done 4.Divide decimal number by 2 5.Go to step 1.

33 Fractions = ???? 2

34 Fractions × × ×10 -2

35 Fractions = 3× × × × × × ×2 -2

36 Problem! = ???? 2

37 Google patriot missile failure for a real-world example

38 What about text? ASCII: One byte per character

39 What about text? Unicode: (Up to) two bytes per character

40 Numbers or text? Each application (MS Word, Excel) expects either (ASCII) text or (“raw binary”) numbers Try opening a an Excel spreadsheet in WordPad!


Download ppt "Lab #1 Follow-Up Unix Binary / Hexadecimal Python."

Similar presentations


Ads by Google