1 / 40

Lab #1 Follow-Up

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 ) 0 0 1 1 2 2 3 3 4 4

Télécharger la présentation

Lab #1 Follow-Up

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

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

  3. Media Access Control (MAC) address

  4. B4-D8-A9-00-04-07

  5. B4-D8-A9-00-04-07

  6. B4-D8-A9-00-04-07

  7. B4-D8-A9-00-04-07

  8. DecimalHex(adecimal) 0 0 11 2 2 3 3 44 5 5 6 6 7 7 88 99 10A 11 B 12C 13D 14 E 15F

  9. DecimalHex(adecimal) 0 0 11 2 2 3 3 44 5 5 6 6 7 7 88 99 10A 11 B 12C 13D 14 E 15F B 4

  10. DecimalHex(adecimal) 0 0 11 2 2 3 3 44 5 5 6 6 7 7 88 99 10A 11 B 12C 13D 14 E 15F B 4 11×16 + 4×1

  11. DecimalHex(adecimal) 0 0 11 2 2 3 3 44 5 5 6 6 7 7 88 99 10A 11 B 12C 13D 14 E 15F B 4 11×161 + 4×160

  12. DecimalHex(adecimal) 0 0 11 2 2 3 3 44 5 5 6 6 7 7 88 99 10A 11 B 12C 13D 14 E 15F B 4 11×16 + 4×1

  13. DecimalHex(adecimal) 0 0 11 2 2 3 3 44 5 5 6 6 7 7 88 99 10A 11 B 12C 13D 14 E 15F B 4 11×16 + 4×1 176 + 4

  14. DecimalHex(adecimal) 0 0 11 2 2 3 3 44 5 5 6 6 7 7 88 99 10A 11 B 12C 13D 14 E 15F B 4 11×16 + 4×1 176 + 4 180

  15. All modern numbering systems work this way B 4 1 8 0 11×161 + 4×160 1×102 + 8×101 + 0×100 11×16 + 4×1 1×100 + 8×10+ 0×1 176 + 4 100 + 80 + 0 180 180

  16. Why Base 16?

  17. Why Base 16? DecimalHexBinary 0 0 0 11 1 22 10 33 11 44 100 55 101 66 110 77 111 88 1000 99 1001 10A 1010 11 B 1011 12C 1100 13D 1101 14 E 1110 15F 1111

  18. Why Base 16? DecimalHexBinary 00 0 0000 011 0001 022 0010 033 0011 044 0100 055 0101 066 0110 077 0111 088 1000 099 1001 10A 1010 11 B 1011 12C 1100 13D 1101 14 E 1110 15F 1111

  19. Eight Bits = One Byte DecimalHexBinary 0 0 0000 11 0001 22 0010 33 0011 44 0100 55 0101 66 0110 7 7 0111 88 1000 99 1001 10A 1010 11 B 1011 12C 1100 13D 1101 14 E 1110 15F 1111 B 4 1011 0100

  20. Why Base Two?

  21. Why Base Two?

  22. ENIAC (1946)

  23. Faster, Cheaper, Smaller Relay Transistor Vacuum tube 1940s 1950s Integrated Circuits 1960s Today

  24. 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 = ??? 10

  25. 1 * 20 = 1 • E.g., 1 1 0 12 = ??? 10 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

  26. 1 * 20 = 1 + 0 * 21 = 0 • E.g., 1 1 0 1 2 = ??? 10 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

  27. 1 * 20 = 1 + 0 * 21 = 0 + 1 * 22 = 4 • E.g., 1 1 0 1 2 = ??? 10 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

  28. 1 * 20 = 1 + 0 * 21 = 0 + 1 * 22 = 4 + 1 * 23 = 8 • E.g.,1 1 0 1 2 = ??? 10 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

  29. 1 * 20 = 1 + 0 * 21 = 0 + 1 * 22 = 4 + 1 * 23 = 8 ____________ 13 • E.g., 1 1 0 1 2 = 1310 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

  30. Decimal-to-Binary Conversion To convert from decimal to binary • Take remainder of decimal number / 2 • Write down remainder right-to-left • If decimal number is zero, we’re done • Divide decimal number by 2 • Go to step 1. 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

  31. Fractions 3.2510 = ????2

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

  33. Fractions 3. 2 5 10 = 1 1. 0 1 2 1×21 + 1×20 + 0×2-1 + 1×2-2 3×100 + 2×10-1 + 5×10-2

  34. Problem! 3.210 = ????2

  35. Google patriot missile failure for a real-world example

  36. What about text? ASCII: One byte per character

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

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

More Related