Fundamentals Of Computing And Information Systems - Chapter 3: Understanding Data - PDF

Summary

This document provides an introduction to various number systems used in computing, including decimal, binary, octal, and hexadecimal. It explains their bases and conversion techniques. The material also covers fundamental concepts of digital logic design. It's suitable for undergraduate-level computer science courses.

Full Transcript

Fundamentals of Computing and Information Systems Chapter 3 – Understanding Data Chapter 3 - Objectives At the end of this chapter, the students will be able to:  Explain the number systems,  Perform number system conversion,  Perform binary addition,  Explain logic gates,...

Fundamentals of Computing and Information Systems Chapter 3 – Understanding Data Chapter 3 - Objectives At the end of this chapter, the students will be able to:  Explain the number systems,  Perform number system conversion,  Perform binary addition,  Explain logic gates,  Draw logic gates diagram, and  Complete truth table Chapter 3 - Topics  Number Systems:  Logic Design Introduction  Logic Gates  Decimal Number System  Basic Gates  Binary Number System  AND Gate  Octal Number System  OR Gate  Hexadecimal Number  NOT Gate System  Universal Gates  Number System Conversions  NAND Gate  Decimal to any number  NOR Gate systems  Combinational Gates  Binary to any number  XOR Gate systems  XNOR Gate  Octal to any number systems  Drawing Logic Gate Diagram  Hexadecimal to any number  Writing Boolean Expression systems from Logic Gate Diagram  Binary Arithmetic  Completing Truth Table  Binary Addition  Logisim: Introduction Number Systems: Introduction A number system is a system of writing to express numbers. It is the mathematical notation for representing numbers of a given set by using digits or other symbols in a consistent manner. Various arithmetic operations like addition, subtraction, multiplication, and division can be done in a number system. Further, the value of any digit in a number can be determined by the following: the digit, its position in the number, and the base or radix of the number system. The number system has its own base or radix. If a number system has a base r, then, the number system has r distinct symbols for r digits. For example, in decimal number system which has a base or radix of 10, the number 815 has 3 digits, which 8 is multiplied by 10 2, 1 is multiplied by 101, and 5 is multiplied by 100. Decimal Number System the base or radix of this number system is 10 it is called base-10 number system. the weight of each digit depends on its relative position within the number. the successive position to the left of the decimal point represents ones, tens, hundreds, thousands, etc. For example, if we consider a decimal number 257, then the digit representations are: 2 5 7 hundreds tens ones Binary Number System the base or radix of the binary number system is 2 it uses only two digits – 0 and 1. Data is represented in a computer system by either the presence or absence of electronic or magnetic signals in its circuitry or the media. Thus, for electronic circuits, the conduction state (ON) represents a 1 (one) and the non-conducting state (OFF) represents a 0 (zero). The binary symbol 0 or 1 is commonly called a bit, which is a contraction of the term binary digit. Binary Number System  In binary number system, the value of the digit will be two times greater than its predecessor. Thus, for instance, the value of the places is: 210 29 28 27 26 25 24 23 22 21 20 1024 512 25 128 64 32 16 8 4 2 1 6 Octal Number System  it has a base or radix of 8, hence, it has eight (8) digit representations which are 0, 1, 2, 3, 4, 5, 6, and 7. Just like other number systems, the value increases from right to left as shown below: 85 84 83 82 81 80 32,76 4096 512 64 8 1 8 Octal Number System Octal Binary Decimal Number Number Number 0 000 0 1 001 1 2 010 2 3 011 3 4 100 4 5 101 5 6 110 6 7 111 7 10 1000 8 11 1001 9 12 1010 10 Octal Number System and their Binary and Decimal Representations Hexadecimal Number System  it has a radix or base of 16, and the numbers are represented as 0,1,2,3,4,5,6,7,8,9, A for 10, B for 11, C for 12, D for 13, E for 14, and F for 15. Hexadecimal Number Binary Number Decimal Number 0 0000 0 1 0001 1 2 0010 2 3 0011 3 4 0100 4 5 0101 5 6 0110 6 7 0111 7 8 1000 8 9 1001 9 A 1010 10 B 1011 11 C 1100 12 D 1101 13 E 1110 14 F 1111 15 Hexadecimal Number System and their Binary and Decimal Representations Number System Conversion Decimal to Binary Number Conversion Decimal numbers are converted into binary by a method called double dabble or repeated-division method. the quotient of the number is repeatedly divided by the base which is two (2) and note the remainders which will be either 0 or 1. This division continues until the quotient becomes zero. The final binary result is obtained by assembling the remainders in reverse order to obtain the binary equivalent of the decimal number. Decimal to Binary Number Conversion Convert 7510 = ___________________2 Remainder 2 75 1 37 1 18 0 9 1 4 0 2 0 1 1 So, 7510 = 0 Take note if the number being divided is odd (a1001011 2. number that ends with 1,3,5,7, and 9), then its remainder is 1 while if the number being divided is even (a number that ends with 0,2,4,6, and 8) the remainder is 0. Decimal to Binary Number Conversion Exercise: Convert 34410 = ___________________2 Decimal to Octal Number Conversion Decimal numbers are converted into octal by a method called Convert 30510 = ____________8 double dabble or repeated- Remainder division method. 8 305 305 – (38*8) the quotient of the number is =1 repeatedly divided by the base 38 38 – (4*8) = 6 which is eight (8) and note the 4 4 – (0*8) = 4 remainders which will be from 0 to 7. 0 This division continues until the So, 30510 = quotient becomes zero. 4618. Decimal to Octal Number Conversion Convert 183910 = __________________8. Remainder 8 1839 1839 – (229*8) = 7 229 229 – (28*8) = 5 28 28 – (3*8) = 4 3 3 – (0*8) = 3 0 So, 183910 = 34578. Decimal to Octal Number Conversion Exercise: Convert 85910 = ___________________8 Decimal to Hexadecimal Number Conversion Decimal numbers are converted into hexadecimal by a method Convert 96810 = _________16 called double dabble or repeated-division method. Remainder Successively divide the given 16 968 968 – (60*16) = 8 decimal number by 16 till the 60 60 – (3*16) = 12 = quotient is zero. C The last remainder is the MSB 3 3 – (0 *16) = 3 (Most Significant Bit). The 0 remainders read from bottom to So, 96810 = 3C816. top give the equivalent hexadecimal integer. Decimal to Hexadecimal Number Conversion Convert 487510 = __________________16. Remainder 16 4875 4875 – (304*16) = 11 = B 304 304 – (19*16) = 0 19 19 – (1*16) = 3 1 1 – (0*16) =1 0 So, 487510 = 130B16. Decimal to Hexadecimal Number Conversion Exercise: Convert 274310 = ___________________16 Binary to Decimal Number Conversion To convert a binary number to its decimal equivalent we use Convert 10102 = _________10 the following expression, the weight of the nth bit of the 23=8 22 = 4 21 = 2 20 = 1 number from right hand side is nth bit × 2n-1. 1 0 1 0 First, we mark the bit position (1*8) (0*4) (2*1) (1*0) and then we give the weight of each bit of the number So, 10102 is equal to 1010 depending on its position. because 8+0+2+0 = 10. The sum of the weight of all bits gives the equivalent number. Binary to Decimal Number Conversion Convert 1100112 = __________________10. 25=32 24=16 23=8 22 = 4 21 = 2 20 = 1 1 1 0 0 1 1 (1*32) (1*16) (0*8) (0*4) (1*2) (1*1) So, 1100112 = 5110 because 32+16+0+0+2+1 = 51. Binary to Decimal Number Conversion Convert 1011101102 = __________________10. 28=256 27=128 26=64 25=32 24=16 23=8 22 = 4 21 = 2 20 = 1 1 0 1 1 1 0 1 1 0 (1*256) (0*128 (1*64) (1*32) (1*16) (0*8) (1*4) (1*2) (0*1) ) So, 1011101102 = 37410 because 256+0+64+32+16+0+4+2+0 = 374. Binary to Decimal Number Conversion Exercise: Convert 1101011012 = ______________10 Octal to Decimal Number Conversion It follows same principle with binary to decimal number Convert 5368 = __________10 conversion, we use the following expression, the weight of the nth 82 = 64 81 = 8 80 = 1 digit of the number from right hand side is nth digit × 8n-1. 5 3 6 First, we mark the digit position (5*64) (3*8) (6*1) and then we give the weight of So, 5368 is equal to 35010 each digit of the number because 320+24+6 = 350. depending on its position. The sum of the weight of all digits gives the equivalent number. Octal to Decimal Number Conversion Convert 47058 = __________________10. 83 = 82 = 64 81 = 8 80 = 1 512 4 7 0 5 (4*512) So, 4705 = 2501(7*64) (0*8) because (5*1) 2048+448+0+5 = 8 10 2501. Octal to Decimal Number Conversion Exercise: Convert 26678 = ___________________10 Hexadecimal to Decimal Number Conversion It follows same principle with binary to decimal number conversion and Convert 3F316 = _________10 octal to decimal number conversion. We use the following expression, the 162 = 161 = 16 160 = 1 weight of the nth digit of the number from right hand side is nth 256 digit × 16n-1. 3 F = 15 3 First, we mark the digit position and then we give the weight of each (3*256) So, 3F316 is(15*16) (3*1) equal to1011 10 digit of the number depending on its because 768+240+3 = position. 1011. The sum of the weight of all digits gives the equivalent number. Hexadecimal to Decimal Number Conversion Convert 2AB616 = __________________10. 163 = 4096 162 = 161 = 16 160 = 1 256 2 A = 10 B = 11 6 (2*4096) (10*256) (11*16) (6*1) So, 2AB616 is equal to 1093410 because 8192+2560+176+6 = 10934. Hexadecimal to Decimal Number Conversion Exercise: Convert D8416 = ___________________10 Octal to Binary Number Conversion 1. Convert each octal digit to a 3-digit binary number (use the 4-2-1 Example #1: method). 4738 = ____________2 Octal Number Binary Number 4738 = 100-111-0112 0 000 1 001 So, the answer is 2 010 1001110112. 3 011 4 100 Example #2: 5 101 6 110 6258 = __________2 7 111 6258 = 110-010-1012 2. Combine all the resulting binary groups (of 3 digits each) into a So, the answer is single binary number. 1100101012. Octal to Binary Number Conversion Exercise: Convert 51678 = ___________________2 Binary to Octal Number Conversion 1. Make a group of 3 bits each Example #1: 11100112 = __________8 starting from right to left.  Make a group of 3 from 2. Replace each group with its right to left equivalent octal number.  So, it will be 001-110-0112 Octal Number Binary Number by adding extra leading 0 000 zeros to complete the 1 001 group of 3. 2 010  Thus, 11100112 = 1638. 3 011 4 100 Example #2: 5 101 110101011112 = __________8. 6 110 7 111 011-010-101-1112 = 32578. Binary to Octal Number Conversion Exercise: Convert 110011001102 = ___________8 Hexadecimal to Binary Number Conversion Hexadecimal Binary Number 1. Convert each octal digit to a 4- Number digit binary number (use the 8- 0 0000 1 0001 4-2-1 method). 2 0010 3 0011 2. Combine all the resulting 4 0100 binary groups (of 4 digits each) 5 0101 into a single binary number. 6 0110 7 0111 8 1000 9 1001 A 1010 B 1011 C 1100 D 1101 E 1110 F 1111 Hexadecimal to Binary Number Conversion Example #1: 6A916 = _____________2 0110-1010-10012 (Note: A is 10) So, the answer is 0110101010012. Example #2: 3CE816 = _____________2 0011-1100-1110-10002 (Note: C is 12, and E is 14) So, the result is 00111100111010002. Hexadecimal to Binary Number Conversion Exercise: Convert 6EC316 = ___________________2 Binary to Hexadecimal Number Conversion Hexadecimal Binary Number Number 1. Make a group of 4 bits each 0 0000 starting from right to left. 1 0001 2 0010 2. Then, replace each group 3 0011 with its equivalent 4 0100 5 0101 hexadecimal number. 6 0110 7 0111 8 1000 9 1001 A 1010 B 1011 C 1100 D 1101 E 1110 F 1111 Binary to Hexadecimal Number Conversion Example #1: Example #2: 10110112 = ______________16. 110100111112 =  Make a group of 4 from __________16. right to left.  Make a group of 4  So, it will be 0101-10112 from right to left by adding extra leading  So, it will be 0110- zero to complete the 1001-11112 by extra group of 4. leading zero to  Thus, 10110112 is 5B16. complete the group of 4.  Thus, 110100111112 is Binary to Hexadecimal Number Conversion Exercise: Convert 101101010111002 = ________16 Octal to Hexadecimal Number Conversion 1. Convert each octal digit to a 3- Example #1: digit binary number (use the 4-2- 6738 = _________16 1 method). 6738 = (110) (111) (011)2 2. Combine all the resulting binary groups (of 3 digits each) into a 1101110112 = (0001) single binary number. (1011) (1011) 3. Divide the binary digits into (Note: add extra leading zeroes groups of 4 (starting from the to complete the group of 4, if right). needed) 4. Convert each group of four binary = 1BB16 digits to one hexadecimal digit (use the 8-4-2-1 method). Octal to Hexadecimal Number Conversion Example #2: 35048 = _________16 35048 = (011) (101) (000) (100)2 011101000100 = (0111)(0100) (0100) = 74416 Octal to Hexadecimal Number Conversion Exercise: Convert 352048 = ___________________16 Hexadecimal to Octal Number Conversion 1. Convert each hexadecimal digit Example #1: to a 4-digit binary number (use the 8-4-2-1 method). 3DE16 = __________8 2. Combine all the resulting binary 3DE16 = (0011) (1101) groups (of 4 digits each) into a (1110)2 single binary number. 001111011110 = (001) 3. Divide the binary digits into groups of 3 (starting from the (111) (011) (110)2 right). (Note: add extra leading zeroes to 4. Convert each group of three complete the group of 3, if binary digits to one octal digit. needed) (Use the 4-2-1 method) = 17368 Hexadecimal to Octal Number Conversion Example #2: 85A16 = ______________8 85A16 = (1000) (0101) (1010)2 100001011010 = (100) (001) (011) (010) (Note: add extra leading zeroes to complete the group of 3, if needed) = 41328 Hexadecimal to Octal Number Conversion Exercise: Convert 2B9C16 = ___________________8 Binary Addition In the binary number system 1 + 0 = 1. When 1 is added to 1, X Y X+Y the sum is 0 with a carry 1. 0 0 0 If the sum is written up to 2 0 1 1 bits, it is equal to 10 (2 decimal). The Table shows the 1 0 1 rules for binary addition. 1 1 Carry -> 10 Binary Addition 1111

Use Quizgecko on...
Browser
Browser