Binary Conversion and Two's Complement Explained
1. Can you convert the following numbers to binary, octal, and hexadecimal? 2. How do you convert numbers between binary, octal, and base 8? 3. What is the two's complement representation of various decimal numbers? 4. How to convert fraction numbers to binary, octal, and hexadecimal? 5. How to increment numbers in octal, hexadecimal, and binary? 6. What is gray code and how to convert it between binary and gray code? 7. How to perform BCD addition and conversion from binary to BCD?
1. Conversion: a) Convert 6 from base 8 to binary: 6 (base 8) = 110 (base 2) b) Convert 18 from base 10 to binary: 18 (base 10) = 10010 (base 2) c) Convert 111 111 000 from base 2 to base 8: 111 111 000 (base 2) = 760 (base 8) d) Convert 110 100 001 from binary to octal: 110 100 001 (base 2) = 641 (base 8) e) Convert 1101 1111 0001 1101 from binary to hexadecimal: 1101 1111 0001 1101 (base 2) = DF1D (base 16) 2. Conversion: a) Convert 110 011 000 from binary to octal: 110 011 000 (base 2) = 630 (base 8) b) Convert 60 from octal to binary: 60 (base 8) = 110 000 (base 2) c) Convert 001 000 111 from binary to base 8: 001 000 111 (base 2) = 217 (base 8) d) Convert 1100 1110 from binary to base 10: 1100 1110 (base 2) = 206 (base 10) e) Convert 45 from base 8 to base 2: 45 (base 8) = 100 101 (base 2) 3. Two's complement representation: a) -3 + 11: -3 (decimal) = 11111101 (eight bit two's complement), 11 (decimal) = 00001011 (eight bit two's complement) b) 125 - 40: 125 (decimal) = 01111101 (eight bit two's complement), -40 (decimal) = 11011000 (eight bit two's complement) c) -23 - 18: -23 (decimal) = 11101001 (eight bit two's complement), -18 (decimal) = 11101110 (eight bit two's complement) d) 440 - 333: 440 (decimal) = 000110111000 (eight bit two's complement), -333 (decimal) = 111100111001 (eight bit two's complement) e) 233 - 432: 233 (decimal) = 11101001 (eight bit two's complement), -432 (decimal) = 11011111 (eight bit two's complement) 4. Fraction numbers: a) Convert 22.48 in decimal to binary: 22.48 (decimal) = 10110.01110101 (binary) b) Convert 133.305 in octal to hexadecimal: 133.305 (octal) = 53.2145 (hexadecimal) c) Convert 24D.EF in hexadecimal to octal: 24D.EF (hexadecimal) = 545.757 (octal) d) Convert 111011.00111 in binary to octal: 111011.00111 (binary) = 73.17 (octal) e) Convert 0.666 in decimal to binary: 0.666 (decimal) = 0.101010 (binary) 5. Incrementing numbers: a) 75, 76, 77, 100, 101, 102, 103, 104 (in octal) b) 2A, 2B, 2C, 2D, 2E, 2F, 30, 31 (in hexadecimal) c) 10A, 10B, 10C, 10D, 10E, 10F, 110 (in hexadecimal) d) 306, 307, 310, 311, 312, 313 (in octal) e) 11010, 11011, 11100, 11101, 11110, 11111 (in binary) 6. Gray code conversion: a) Convert 111 in binary to gray code: 111 (binary) = 101 (gray code) b) Convert 11110 in gray code to binary: 11110 (gray code) = 11010 (binary) c) Convert 11111111 in binary to gray code: 11111111 (binary) = 11011010 (gray code) d) Convert 11111000011 from gray code to binary: 11111000011 (gray code) = 11011001101 (binary) e) Convert 111111000011 from binary to gray code: 111111000011 (binary) = 110101111011 (gray code) 7. BCD addition: a) Add 18 and 12 in BCD: 18 (BCD) + 12 (BCD) = 30 (BCD) b) Add 277 and 333 in BCD: 277 (BCD) + 333 (BCD) = 610 (BCD) c) Add 351 and 377 in BCD: 351 (BCD) + 377 (BCD) = 728 (BCD) d) Convert 1000111 in binary to BCD: 1000111 (binary) = 71 (BCD)