Upload
dandre-cochran
View
251
Download
4
Tags:
Embed Size (px)
Citation preview
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
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
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
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
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
● 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
● 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
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
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
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
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
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.