Lab #1 Follow-Up
-
Upload
clarke-burch -
Category
Documents
-
view
20 -
download
0
description
Transcript of Lab #1 Follow-Up
![Page 1: Lab #1 Follow-Up](https://reader030.fdocuments.net/reader030/viewer/2022032709/568130dc550346895d96edae/html5/thumbnails/1.jpg)
Lab #1 Follow-Up• Unix• Binary / Hexadecimal• Python
![Page 2: Lab #1 Follow-Up](https://reader030.fdocuments.net/reader030/viewer/2022032709/568130dc550346895d96edae/html5/thumbnails/2.jpg)
Lab #1 Follow-Up• Unix• Binary / Hexadecimal• Python
![Page 3: Lab #1 Follow-Up](https://reader030.fdocuments.net/reader030/viewer/2022032709/568130dc550346895d96edae/html5/thumbnails/3.jpg)
![Page 4: Lab #1 Follow-Up](https://reader030.fdocuments.net/reader030/viewer/2022032709/568130dc550346895d96edae/html5/thumbnails/4.jpg)
Media Access Control (MAC) address
![Page 5: Lab #1 Follow-Up](https://reader030.fdocuments.net/reader030/viewer/2022032709/568130dc550346895d96edae/html5/thumbnails/5.jpg)
B4-D8-A9-00-04-07
![Page 6: Lab #1 Follow-Up](https://reader030.fdocuments.net/reader030/viewer/2022032709/568130dc550346895d96edae/html5/thumbnails/6.jpg)
B4-D8-A9-00-04-07
![Page 7: Lab #1 Follow-Up](https://reader030.fdocuments.net/reader030/viewer/2022032709/568130dc550346895d96edae/html5/thumbnails/7.jpg)
B4-D8-A9-00-04-07
![Page 8: Lab #1 Follow-Up](https://reader030.fdocuments.net/reader030/viewer/2022032709/568130dc550346895d96edae/html5/thumbnails/8.jpg)
B4-D8-A9-00-04-07
![Page 9: Lab #1 Follow-Up](https://reader030.fdocuments.net/reader030/viewer/2022032709/568130dc550346895d96edae/html5/thumbnails/9.jpg)
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](https://reader030.fdocuments.net/reader030/viewer/2022032709/568130dc550346895d96edae/html5/thumbnails/10.jpg)
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](https://reader030.fdocuments.net/reader030/viewer/2022032709/568130dc550346895d96edae/html5/thumbnails/11.jpg)
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](https://reader030.fdocuments.net/reader030/viewer/2022032709/568130dc550346895d96edae/html5/thumbnails/12.jpg)
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](https://reader030.fdocuments.net/reader030/viewer/2022032709/568130dc550346895d96edae/html5/thumbnails/13.jpg)
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](https://reader030.fdocuments.net/reader030/viewer/2022032709/568130dc550346895d96edae/html5/thumbnails/14.jpg)
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](https://reader030.fdocuments.net/reader030/viewer/2022032709/568130dc550346895d96edae/html5/thumbnails/15.jpg)
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](https://reader030.fdocuments.net/reader030/viewer/2022032709/568130dc550346895d96edae/html5/thumbnails/16.jpg)
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](https://reader030.fdocuments.net/reader030/viewer/2022032709/568130dc550346895d96edae/html5/thumbnails/17.jpg)
Why Base 16?
![Page 18: Lab #1 Follow-Up](https://reader030.fdocuments.net/reader030/viewer/2022032709/568130dc550346895d96edae/html5/thumbnails/18.jpg)
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](https://reader030.fdocuments.net/reader030/viewer/2022032709/568130dc550346895d96edae/html5/thumbnails/19.jpg)
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](https://reader030.fdocuments.net/reader030/viewer/2022032709/568130dc550346895d96edae/html5/thumbnails/20.jpg)
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](https://reader030.fdocuments.net/reader030/viewer/2022032709/568130dc550346895d96edae/html5/thumbnails/21.jpg)
Why Base Two?
![Page 22: Lab #1 Follow-Up](https://reader030.fdocuments.net/reader030/viewer/2022032709/568130dc550346895d96edae/html5/thumbnails/22.jpg)
Why Base Two?
![Page 23: Lab #1 Follow-Up](https://reader030.fdocuments.net/reader030/viewer/2022032709/568130dc550346895d96edae/html5/thumbnails/23.jpg)
ENIAC (1946)
![Page 24: Lab #1 Follow-Up](https://reader030.fdocuments.net/reader030/viewer/2022032709/568130dc550346895d96edae/html5/thumbnails/24.jpg)
1940s
Faster, Cheaper, Smaller
1950s
1960s Today
Vacuum tubeRelay Transistor
IntegratedCircuits
![Page 25: Lab #1 Follow-Up](https://reader030.fdocuments.net/reader030/viewer/2022032709/568130dc550346895d96edae/html5/thumbnails/25.jpg)
![Page 26: Lab #1 Follow-Up](https://reader030.fdocuments.net/reader030/viewer/2022032709/568130dc550346895d96edae/html5/thumbnails/26.jpg)
● 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](https://reader030.fdocuments.net/reader030/viewer/2022032709/568130dc550346895d96edae/html5/thumbnails/27.jpg)
● 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](https://reader030.fdocuments.net/reader030/viewer/2022032709/568130dc550346895d96edae/html5/thumbnails/28.jpg)
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](https://reader030.fdocuments.net/reader030/viewer/2022032709/568130dc550346895d96edae/html5/thumbnails/29.jpg)
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](https://reader030.fdocuments.net/reader030/viewer/2022032709/568130dc550346895d96edae/html5/thumbnails/30.jpg)
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](https://reader030.fdocuments.net/reader030/viewer/2022032709/568130dc550346895d96edae/html5/thumbnails/31.jpg)
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](https://reader030.fdocuments.net/reader030/viewer/2022032709/568130dc550346895d96edae/html5/thumbnails/32.jpg)
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](https://reader030.fdocuments.net/reader030/viewer/2022032709/568130dc550346895d96edae/html5/thumbnails/33.jpg)
Fractions
3.2510 = ????2
![Page 34: Lab #1 Follow-Up](https://reader030.fdocuments.net/reader030/viewer/2022032709/568130dc550346895d96edae/html5/thumbnails/34.jpg)
Fractions
3. 2 5 3×100 + 2×10-1 + 5×10-2
![Page 35: Lab #1 Follow-Up](https://reader030.fdocuments.net/reader030/viewer/2022032709/568130dc550346895d96edae/html5/thumbnails/35.jpg)
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](https://reader030.fdocuments.net/reader030/viewer/2022032709/568130dc550346895d96edae/html5/thumbnails/36.jpg)
Problem!
3.210 = ????2
![Page 37: Lab #1 Follow-Up](https://reader030.fdocuments.net/reader030/viewer/2022032709/568130dc550346895d96edae/html5/thumbnails/37.jpg)
Google patriot missile failure for areal-world example
![Page 38: Lab #1 Follow-Up](https://reader030.fdocuments.net/reader030/viewer/2022032709/568130dc550346895d96edae/html5/thumbnails/38.jpg)
What about text?ASCII: One byte per character
![Page 39: Lab #1 Follow-Up](https://reader030.fdocuments.net/reader030/viewer/2022032709/568130dc550346895d96edae/html5/thumbnails/39.jpg)
What about text?Unicode: (Up to) two bytes per character
![Page 40: Lab #1 Follow-Up](https://reader030.fdocuments.net/reader030/viewer/2022032709/568130dc550346895d96edae/html5/thumbnails/40.jpg)
Numbers or text?• Each application
(MS Word, Excel) expects either (ASCII) text or (“raw binary”) numbers
• Try opening a an Excel spreadsheet in WordPad!