Lab #1 Follow-Up

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

description

Lab #1 Follow-Up. Unix Binary / Hexadecimal Python. Lab #1 Follow-Up. Unix Binary / Hexadecimal Python. Media Access Control (MAC) address. B4 -D8-A9-00-04-07. B4 -D8-A9-00-04-07. B4 -D8-A9-00-04-07. B4 -D8-A9-00-04-07. Decimal Hex( adecimal ) 00 1 1 2 2 3 3 4 4 - PowerPoint PPT Presentation

Transcript of Lab #1 Follow-Up

Page 1: Lab #1 Follow-Up

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

Page 2: Lab #1 Follow-Up

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

Page 3: Lab #1 Follow-Up
Page 4: Lab #1 Follow-Up

Media Access Control (MAC) address

Page 5: Lab #1 Follow-Up

B4-D8-A9-00-04-07

Page 6: Lab #1 Follow-Up

B4-D8-A9-00-04-07

Page 7: Lab #1 Follow-Up

B4-D8-A9-00-04-07

Page 8: Lab #1 Follow-Up

B4-D8-A9-00-04-07

Page 9: Lab #1 Follow-Up

Decimal Hex(adecimal)

0 01 12 23 34 45 56 67 78 89 910 A11 B12 C13 D14 E15 F

Page 10: Lab #1 Follow-Up

B 4

Decimal Hex(adecimal)

0 01 12 23 34 45 56 67 78 89 910 A11 B12 C13 D14 E15 F

Page 11: Lab #1 Follow-Up

B 4

Decimal Hex(adecimal)

0 01 12 23 34 45 56 67 78 89 910 A11 B12 C13 D14 E15 F

11×16 + 4×1

Page 12: Lab #1 Follow-Up

B 4

Decimal Hex(adecimal)

0 01 12 23 34 45 56 67 78 89 910 A11 B12 C13 D14 E15 F

11×161 + 4×160

Page 13: Lab #1 Follow-Up

B 4

Decimal Hex(adecimal)

0 01 12 23 34 45 56 67 78 89 910 A11 B12 C13 D14 E15 F

11×16 + 4×1

Page 14: Lab #1 Follow-Up

B 4

Decimal Hex(adecimal)

0 01 12 23 34 45 56 67 78 89 910 A11 B12 C13 D14 E15 F

11×16 + 4×1176 + 4

Page 15: Lab #1 Follow-Up

B 4

Decimal Hex(adecimal)

0 01 12 23 34 45 56 67 78 89 910 A11 B12 C13 D14 E15 F

11×16 + 4×1176 + 4

180

Page 16: Lab #1 Follow-Up

All modern numbering systems work this way

B 411×161 + 4×160

11×16 + 4×1176 + 4

180

1 8 01×102 + 8×101 + 0×100

100 + 80 + 0

1×100 + 8×10 + 0×1

180

Page 17: Lab #1 Follow-Up

Why Base 16?

Page 18: Lab #1 Follow-Up

Why Base 16?Decimal Hex Binary

0 0 01 1 12 2 103 3 114 4 1005 5 1016 6 1107 7 1118 8 10009 9 100110 A 101011 B 101112 C 110013 D 110114 E 111015 F 1111

Page 19: Lab #1 Follow-Up

Why Base 16?Decimal Hex Binary

00 0 000001 1 000102 2 001003 3 001104 4 010005 5 010106 6 011007 7 011108 8 100009 9 100110 A 101011 B 101112 C 110013 D 110114 E 111015 F 1111

Page 20: Lab #1 Follow-Up

B 4

Eight Bits = One ByteDecimal Hex Binary

0 0 00001 1 00012 2 00103 3 00114 4 01005 5 01016 6 01107 7 01118 8 10009 9 100110 A 101011 B 101112 C 110013 D 110114 E 111015 F 1111

1011 0100

Page 21: Lab #1 Follow-Up

Why Base Two?

Page 22: Lab #1 Follow-Up

Why Base Two?

Page 23: Lab #1 Follow-Up

ENIAC (1946)

Page 24: Lab #1 Follow-Up

1940s

Faster, Cheaper, Smaller

1950s

1960s Today

Vacuum tubeRelay Transistor

IntegratedCircuits

Page 25: Lab #1 Follow-Up
Page 26: Lab #1 Follow-Up

● 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., 1 1 0 1 2 = ??? 10

Binary-to-Decimal Conversion

Page 27: Lab #1 Follow-Up

● 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., 1 1 0 1 2 = ??? 101 * 20 =

1

Binary-to-Decimal Conversion

Page 28: Lab #1 Follow-Up

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., 1 1 0 1 2 = ??? 101 * 20 =

1+ 0 * 21 = 0

Page 29: Lab #1 Follow-Up

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., 1 1 0 1 2 = ??? 101 * 20 =

1+ 0 * 21 = 0+ 1 * 22 = 4

Page 30: Lab #1 Follow-Up

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., 1 1 0 1 2 = ??? 101 * 20 =

1+ 0 * 21 = 0+ 1 * 22 = 4+ 1 * 23 = 8

Page 31: Lab #1 Follow-Up

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., 1 1 0 1 2 = 13 101 * 20 =

1+ 0 * 21 = 0+ 1 * 22 = 4+ 1 * 23 = 8

____________

13

Page 32: Lab #1 Follow-Up

13 r 2 = 1

13 ÷ 2 = 6

6 r 2 = 0

6 ÷ 2 = 3

3 r 2 = 1

3 ÷ 2 = 1

1 r 2 = 1

1 ÷ 2 = 0

___________

1 1 0 1

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.

Page 33: Lab #1 Follow-Up

Fractions

3.2510 = ????2

Page 34: Lab #1 Follow-Up

Fractions

3. 2 5 3×100 + 2×10-1 + 5×10-2

Page 35: Lab #1 Follow-Up

Fractions

3. 2 5 10 =

3×100 + 2×10-1 + 5×10-2

1 1. 0 1 2

1×21 + 1×20 + 0×2-1 + 1×2-2

Page 36: Lab #1 Follow-Up

Problem!

3.210 = ????2

Page 37: Lab #1 Follow-Up

Google patriot missile failure for areal-world example

Page 38: Lab #1 Follow-Up

What about text?ASCII: One byte per character

Page 39: Lab #1 Follow-Up

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

Page 40: Lab #1 Follow-Up

Numbers or text?• Each application

(MS Word, Excel) expects either (ASCII) text or (“raw binary”) numbers

• Try opening a an Excel spreadsheet in WordPad!