Number Systems
Number Systems: Decimal Binary Hexadecimal Binary Coded Decimal (BCD)
The decimal system is a base 10 (modulo 10) number system: 10 digits: 0 1 2 3 4 5 6 7 8 9 Counting beyond 9 requires additional place values as powers of 10: ______ ______ ______ ______ ______ 10000 1000 100 10 1 (104) (103) (102) (101) (100)
(in digital terms, logic 0 or logic 1) The Binary System: The Binary System is a base 2 (mod 2) number system: 2 digits: 0 or 1 (in digital terms, logic 0 or logic 1) Counting beyond 1 requires additional place values as powers of 2: ______ ______ ______ ______ ______ 16 8 4 2 1 (24) (23) (22) (21) (20)
Example: Convert 3710 to binary. METHOD I: Sum-of-weights: ____ ____ ____ ____ ____ ____ 32 16 8 4 2 1 METHOD II: Repeated-division-by-base (here, base 2) 37/2 = 18 remainder of 1 This is your LSB 18/2 = 9 remainder of 0 9/2 = 4 remainder of 1 4/2 = 2 remainder of 0 2/2 = 1 remainder of 0 ½ = 0 remainder of 1 This is your MSB This process gives you the same result: 3710 is 100101 in binary. 1 1 1
Convert 10110102 to decimal: Sum-of-weights uses total of each place value: 1x64 + 0x32 + 1x16 + 1x8 + 0x4 + 1x2 + 0x 1 = 9010
The Hexadecimal System The Hexadecimal system is a base 16 (mod 16) number system: “Hexa” = 6 “Decimal” = 10 16 digits: 0123456789 A b C d E F representing decimal 10 through decimal 15 (use of lower case helps differentiate between b and 8 or d and 0 in a digital display)
Convert 5810 to hexadecimal: Sum-of-weights: ____ ____ ____ 256 16 1 Check: 3x16 + 10x1 = 48+10 = 5810 = 3A16 ***Repeated division-by-base is most effective for larger conversions. 3 A
THE SHORTCUT FOR CONVERTING Tips for Conversions: THE SHORTCUT FOR CONVERTING BINARY TO HEXADECIMAL HEXADECIMAL TO BINARY Since there is a relationship between 2 and 16 (24 = 16), there is a relationship between the place values in binary and the place values in hexadecimal – look for groups of 4 instead of 3. Example: Convert 101101012 to hexadecimal: 1011 0101 = b516
Tips for Conversions (Continued): Convert 3F716 to binary: *Remember to represent each digit as a 4-bit binary word!* 0011 1111 0111 Drop initial 0’s to simplify. 3F716 = 1111110111
Binary Coded Decimals (BCD) Uses a 4-bit binary representation of each digit in decimal Example: 672 in BCD would be 0110 0111 0010 Example: 1001 0110 0101 1000 is BCD for 9658 ***In BCD, there will not be values beyond 1001 (decimal 9)