Number Systems Dolly Indra Number Systems/Digital System/FIK/dollyindra/2015 Number Systems • The number system is way for represent amount of physical quantities. For instance : • Decimal Number • Binary Number • Hexadecimal Number Number Systems/Digital System/FIK/dollyindra/2015 • DECIMAL NUMBER • For example Decimal Number : 2,3,6,10,20,100, etc • Note: For decimal number known as base ten (10). Then be : 2(10), 3(10), 6(10), 20(10) ……. etc Number Systems/Digital System/FIK/dollyindra/2015 • BINARY NUMBER • Binary number system using two types of symbol numbers, namely : 0 and 1. • Note : For Binary number system known as base 2. • For example the binary numbers : • 001,010,0011,110111,111100111,etc • Note : For binary number or base 2 (2) to implementation on programming with add the latter b or B after the last number. Number Systems/Digital System/FIK/dollyindra/2015 • BINARY NUMBER (cont) For example : 001, 010 0011,1101 11001,11110 001110,101010 etc 3 bits 4 bits 5 bits 6 bits Number Systems/Digital System/FIK/dollyindra/2015 • HEXADECIMAL NUMBER • Hexadecimal number system using sixteen types of symbol, namely: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F. • Note : For Hexadecimal number system known as base 16. • For example: Hexadecimal numbers, such as this below: • 10(16), C0(16), FF(16), AB(16), or 10h, C0h, FFh, or 10H, C0H, FFH, etc Number Systems/Digital System/FIK/dollyindra/2015 • HEXADECIMAL NUMBER (cont) For example : • 10(16), 80(16) • FF(16), AB(16) • ABF(16), ACB(16) • ACDF(16), FFFF(16) • etc Number Systems/Digital System/FIK/dollyindra/2015 • How to do Conversion Numbers • If we want to convert something to decimal number then we have to do multiplication based on its base number • If we want to convert decimal number to something then we must do division based on its base number Number Systems/Digital System/FIK/dollyindra/2015 • How to Conversions from Binary to Decimal • For Example: the conversions the binary value 1111 & 101101 to decimal or 1111(2) = -----(10) & 101101(2) = -----(10) • The way of finishing to this case is : ( 1 0 1 101 ) MSB = Most Significant Bit LSB = Least Significant Bit Number Systems/Digital System/FIK/dollyindra/2015 How to Conversions from Binary to Decimal (cont) (1 1 1 1) 0 1 2 3 ( 1x 2 ) + ( 1x 2 ) + ( 1 x 2 ) + ( 1 x 2 ) 8 + 4 + 2 + 1 = 15 (10 ) Number Systems/Digital System/FIK/dollyindra/2015 How to Conversions from Binary to Decimal (cont) ( 1 0 1 1 0 1 ) 5 4 32 + 0 + 3 2 1 0 ( 1x 2 )+(0 x 2 )+( 1x 2 )+( 1x 2 )+( 0 x 2 ) + ( 1 x 2 ) 8 + 4 + 0 + 1 = 45 (10) Number Systems/Digital System/FIK/dollyindra/2015 How to Conversions from Binary to Decimal (cont) Or another way is memorized the sequence below: Or another way is 10 memorized the sequence bits below: 512 256 128 64 32 16 8 4 2 1 Or another way is memorized the sequence below: 9 8 7 6 5 4 3 2 1 Or way the sequence 2 another 2 2 is 2memorized 2 2 2 2 2 2 below: 0 Number Systems/Digital System/FIK/dollyindra/2015 How to Conversions from Binary to Decimal (cont) • Repeat the previous examples in this way : 1111(2) = -----(10) & 101101(2) = -----(10) (1 1 1 1) 8 + 4 + 2 + 1 = 15 (10 Number Systems/Digital System/FIK/dollyindra/2015 How to Conversions from Binary to Decimal (cont) • Repeat the previous examples in this way : 101101(2) = -----(10) ( 1 0 1 1 0 1 ) 32 + 8 + 4 + 1 = 45 (10) Number Systems/Digital System/FIK/dollyindra/2015 How to Conversions from Hexadecimal to Decimal • For Example: the conversions the hexadecimal value of C6 to decimal or C6(16) = -----(10) The way of finishing to this case is there 2 steps : 1. The first, change the number to binary and then merge these numbers, the finally change to decimal. 2. The second, see the table above and then multiply with base 16 Number Systems/Digital System/FIK/dollyindra/2015 Table of Hexadecimal DECIMAL HEXADECIMAL DECIMAL HEXADECIMAL 0 0 8 8 1 1 9 9 2 2 10 A 3 3 11 B 4 4 12 C 5 5 13 D 6 6 14 E 7 7 15 F Number Systems/Digital System/FIK/dollyindra/2015 How to Conversions from Hexadecimal to Decimal (cont) • For Example: the conversions the hexadecimal value of C6 to decimal or C6(16) = -----(10) Using the First step : C = 12 10 bits 512 256 128 64 32 16 8 1 6 4 1 2 0 1 0 4 1 2 1 1 0 10 bits 512 256 128 64 32 16 8 Number Systems/Digital System/FIK/dollyindra/2015 How to Conversions from Hexadecimal to Decimal (cont) 10 bits 512 256 128 64 32 16 8 4 2 1 1 1 0 0 0 1 1 0 192 + 6 = 198(10 ) Number Systems/Digital System/FIK/dollyindra/2015 How to Conversions from Hexadecimal to Decimal (cont) • Using the Second step : (C 6 ) 1 0 (12 x 16 ) + ( 6 x 16 ) 192 6 = 198(10 ) Number Systems/Digital System/FIK/dollyindra/2015 How to Conversions from Hexadecimal to Decimal (cont) • For Example: the conversions the hexadecimal value of B32 to decimal or B32(16) = -----(10) B = 11 10 bits 512 256 128 64 32 16 8 1 4 0 2 1 1 1 8 0 4 0 2 1 1 1 3 10 bits 512 256 128 64 32 16 2 10 bits 512 256 128 64 32 16 8 0 4 0 2 1 1 0 Number Systems/Digital System/FIK/dollyindra/2015 How to Conversions from Hexadecimal to Decimal (cont) 12 bits 2048 1024 512 256 128 64 32 16 8 0 0 1 1 0 1 0 1 1 2048 + 2816 4 0 2 1 768 50 + 2866 (10) Number Systems/Digital System/FIK/dollyindra/2015 1 0 How to Conversions from Hexadecimal to Decimal (cont) • Or using the second step : ( B 2 3 ) 2 x 16 ) + 1 ( 3 x 16 ) 11 x 256 ) + ( 3 x16) 2816 + 48 ( 11 2816 0 + ( 2 x 16 ) + ( 2 x 1) + + 2 50 = 2866 (10 ) Number Systems/Digital System/FIK/dollyindra/2015 Exercises • Convert the following binary and hexadecimal numbers to decimal : 1. 1001(2) = -----(10) 2. 110111(2) = -----(10) 3. 1101001(2) = -----(10) 4. FF(16) = -----(10) 5. 2AD(16) = -----(10) 6. 1234(16) = -----(10) Number Systems/Digital System/FIK/dollyindra/2015 How to Conversions from Binary to Hexadecimal and otherwise • To convert from binary to hexadecimal, group the binary number in groups of four bits (starting in the least significant position). Number Systems/Digital System/FIK/dollyindra/2015 How to Conversions from Binary to Hexadecimal and otherwise (cont) • For example : 011101(2) and 01101100(2) to hex 011101 0 0 0 1 11 0 1 1 D 01110 1( 2) = 1D(16) Number Systems/Digital System/FIK/dollyindra/2015 How to Conversions from Binary to Hexadecimal and otherwise (cont) • For example : 01101100(2) to hex 0110110 0 0 1 1 0 110 0 6 C 0110110 0(2) = 6C(16) Number Systems/Digital System/FIK/dollyindra/2015 How to Conversions from Binary to Hexadecimal and otherwise (cont) • For example : A9(16) and 2A6(16) to binary A 9 A = 10 1 0 1 0 100 1 10 A 9 A 9 (16) = 1010100 1(2) Number Systems/Digital System/FIK/dollyindra/2015 How to Conversions from Binary to Hexadecimal and otherwise (cont) • For example : 2A6(16) to binary 2 A 6 A = 10 0 0 1 0 1 0 1 0 011 0 10 2 A 6 2 A 6 (16) = 00101010 0110(2) Number Systems/Digital System/FIK/dollyindra/2015