Page 1 of 22 UNIT – I - BINARY SYSTEMS DIGITAL SYSTEMS Digital systems have such a prominent role in everyday life that we refer to the present technological period as the digital age. Digital systems are used in communication, business transactions, traffic control, spacecraft guidance, medical treatment, whether monitoring, the internet and many other commercial, industrial and scientific enterprises. One characteristic of digital system is their ability to represent and manipulate discrete elements of information. Any set that is restricted to a finite number of elements contains discrete information. Examples of discrete sets are the 10 decimal digits, the 26 letters of the alphabet, the 52 playing cards and the 64 squares of a chessboard. The information is represented in a digital system by physical quantities called signals. The signals in electronic digital systems use two discrete values and are therefore said to be binary. A binary digit called bit has two values: 0 and1. The general purpose digital computer is the best example of a digital system. A digital computer can accommodate many input and output devices. One very useful device is a communication unit that provides interaction with other users through the internet. Like a digital computer, most digital devices are programmable. By changing the program in a programmable device, the same underlying hardware can be used for many different applications. Discrete systems can be made to operate with extreme reliability by using error ‐ correction code. To understand the operation of each digital module, it is necessary to have a basic knowledge of digital circuits and their logical functions. BINARY NUMBERS A decimal number such as 7392 represents a quantity equal to 7000+300+90+2 7392 is a shorthand notation for what should be written as 7 X 103 + 3 X 102 + 9 X 101 +2 X 100 In general a number with a decimal point is represented by a series of coefficients as a5 a4 a3 a2 a1 a0 . a‐1 a‐2 a‐3 The coefficients aj are any of the 10 digits (0,1,2,3,4,5,6,7,8,9) and the subscript value j gives the place value and hence the power of 10 by which the coefficient must be multiplied. Thus the preceding decimal number can be expressed as 105a5 +104a4 +103a3 +102a2 +101a1 +100a0 +10‐1a‐1+10‐2 a‐2 10‐3a‐3 The decimal system is said to be of base or radix 10. 10 because it uses 10 digits and the coefficients are multiplied by powers of 10. A radix point (decimal point) distinguishes positive powers of 10 from negative power of 10. For example the number 26.75 is expressed as 2 X 101 + 6 X 100 + 7 X 10‐1 + 5 X 10‐2 A binary system has only two possible values: 0 and 1. Each coefficient aj is multiplied by a power of radix 2 and the results are added to obtain the decimal equivalent of the number. For example (26.75)10 = (11010.11)2 the binary number is expressed as 1 X 24 + 1 X 23 + 0 X 22 +1 X 21 + 0 X 20 + 1 X 2‐1 + 1 X 2‐2 In general a number is expressed in a base r system has coefficients multiplied by powers of r as an . rn + an‐1 . rn‐1 + ‐ ‐ ‐ + a2 . r2 + a1 . r + a0 + a‐1 . r‐1 + a‐2 . r‐2 + ‐ ‐ ‐ + a‐m . r‐m The coefficients aj range in value from 0 to r‐1 For an example (4021.2)5 = 4 X 53 +0 X 52 + 2 X 51 + 1 X 50 + 2 X 5‐1 = (511.4)10 The decimal i.e base 10 system has 10 digits: 0,1,2,3,4,5,6,7,8,9 The octal i.e base 8 system has 8 digits: 0,1,2,3,4,5,6,7 The Hexadecimal i.e base 16 system has 16 digits: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F The letters of alphabet are used to supplement the 10 decimal digits when the base of the number is greater than 10. In hexadecimal system letters A.B.C,D.E and F are used for the digits 10,11,12,13,14 and 15 For an example (B65F)16 = 11 X 163 + 6 X 162 + 5 X 161 + 15 X 160 = (46687)10
Page 2 of 22 The digits in a binary number are called bits. When a bit is equal to 0, it does not contribute to sum during the conversion. Therefore the conversion from binary to decimal can be obtained by adding only the numbers with powers of two corresponding to bits that are equal to1. For an example (110101)2 = 32 + 16 + 4 +1 = (53)10 In computer work 210 is referred as K (Kilo), 220 is referred as M (Mega) 230 is referred as G (Giga) and 240 is referred as T (Tera). The addition and subtraction and multiplication of binary numbers is as follows NUMBER – BASE CONVERSIONS Representation of a number in a different radix are said to be equivalent if they have the same decimal representation. For an example (0011)8 and (1001)2 are equivalent – both have decimal value 9 If the number includes a radix point, it is necessary to separate the number into an integer part and fraction part, since each part must be converted differently. EX – 1 Convert decimal 41 to binary. EX – 2 Convert decimal 153 to octal. EX – 3 Convert (0.6875)10 to binary. The answer is (0.6875)10 = (0.1011)2 EX – 4 Convert (0.513)10 to octal. EX – 5 Convert (41.6875)10 to decimal. The conversion of decimal numbers with both integer and fraction parts is done by converting the integer and the fraction separately and then combining the two answers. Using the results of examples 1 and 3 we obtain (41.687)10 = (101001.1011)2
Page 3 of 22 EX – 6 Convert (153. 513)10 to octal. The conversion of decimal numbers with both integer and fraction parts is done by converting the integer and the fraction separately and then combining the two answers. Using the results of examples 2 and 4 we obtain (153.513)10 = (231.406517)8 OCTAL AND HEXADECIMAL NUMBERS The conversion from and to binary, octal and hexadecimal plays an important role in digital computers, because shorter patterns of hex characters are easier to recognize than long patterns of 1’s and 0’s. The conversion from binary to octal is easily accomplished by partitioning the binary number into groups of three digits each, starting from the binary point and proceeding to the left and to the right. The corresponding octal digit is assigned to each group. For an example Conversion from binary to hexadecimal is similar, except that the binary number is divided into groups of four digits. For example Conversion from octal or hexadecimal to binary is done by reversing the preceding procedure. Each octal digit is converted to its three – digit binary equivalent. Similarly each hexadecimal digit is converted to its four – digit binary equivalent. Examples are Binary numbers are difficult to work with. For example the binary number 111111111111 is equivalent to decimal 4095. Digital computers use binary numbers and it is necessary for an user to communicate with the machine by means of such numbers. One scheme is that converts binary to octal or hexadecimal and communicate the machine. Thus the binary number 111111111111 has 12 digits and is expressed in octal as 7777 (4 digits) or in hexadecimal as FFF (3 digits). Most computer manuals use either octal or hexadecimal numbers to specify binary quantities. Mostly hexadecimal is preferred. Corresponding hexadecimal and octal digit for each group of binary digits are listed in Table 1.2 COMPLEMENTS OF NUMBERS Complements are used in digital computers to simplify the subtraction operation and for logical manipulation. There are two types of complements (1) Diminishing radix complement or (r ‐ 1)’s complement and (2) Radix compliment or r’s complement. The two types are referred as 1’s complement , 2’s complement for binary numbers and 9’s complement, 10’s complement for decimal numbers (1) DIMINISHING RADIX or (r ‐ 1)’s COMPLEMENT Given a number N in base r having n digits, the (r ‐ 1)’s complement of N is defined as (rn ‐ 1) – N For decimal number, r = 10 and r – 1 = 9, so the 9’s complement of N is (10n ‐ 1) – N. 10n represents a number that consists of a single 1 followed by n 0’s 10n – 1 is a number represented by n 9’s
Page 4 of 22 For example if n = 4 we have 104 = 10000 and 104 – 1 = 9999 That means 9’s complement of a decimal number is obtained by subtracting each digit from 9. For an example the 9’s complement of 546700 is 999999 – 546700 = 453299 Another example is the 9’s complement of 012398 is 999999 – 012398 = 987601 For binary numbers, r = 2 and r – 1 = 1, so the 1’s complement of N is (2n ‐ 1) – N 2n represents a binary number that consists of a single 1 followed by n 0’s 2n – 1 is a number represented by n 1’s For example if n = 4 we have 24 = (10000)2 and 24 – 1 = (1111)2 That means 1’s complement of a binary number is obtained by subtracting each digit from 1. However, when subtracting binary digits from 1, we can have either 1 – 0 = 1 or 1 – 1 = 0, which causes the bit to change from 0 to 1 or 1 to 0 respectively. Therefore the 1’s complement of a binary number is formed by changing 1’s to 0’s and 0’s to 1’s For example the 1’s complement of 1011000 is 0100111 And I’s complement of 010101 is 101010 The (r ‐ 1)’s complement of octal or hexadecimal number is obtained by subtracting each digit from 7 or F (decimal 15) respectively. (2) RADIX or r’s COMPLEMENT Given a number N in base r having n digits, the r’s complement of N is defined as rn – N for N ≠ 0 Comparing with (r ‐ 1)’s complement, r’s complement can be obtained by adding 1 to the (r ‐ 1)’s complement. i.e. rn – N = [(rn ‐ 1) – N] + 1 Thus r’s complement can be found by adding 1 to (r ‐ 1)’s complement. 10’s complement of 012398 is 987602 10’s complement of 246700 is 753300 (Thus the 10’s complement of the first number is obtained by subtracting 8 from 10 in the least significant position and subtracting all other digits from9. The 10’s complement of the second number is obtained by leaving the two least significant 0’s unchanged, subtracting 7 from 10 and subtracting all other digits from9.) The 2’s complement of 0110111 is 1001001 The 2’s complement of 1101100 is 0010100 (Thus the 2’s complement of the first number is obtained by leaving the least significant 1 unchanged and complementing all other digits. The 2’s complement of the second number is obtained by leaving the two least significant 0’s and first 1 unchanged, and then complementing all other digits.) If the original number N contains a radix point, the point should be removed temporarily in order to form r’s or (r – 1)’s complement. The radix point is then restored to the complemented number in the same position. The complement of the complement restores the number to its original value. r’s complement of N is rn – N and r’s complement of rn – N is rn – (rn – N) = N and is original number SUBTRACTION WITH COMPLEMENT The subtraction of two n – digit unsigned numbers M – N in base r can be done as follows 1) Add the minuend M to the r’s complement of the subtrahend N. Mathematically M + (rn – N) = M – N + rn 2) If M ≥ N, the sum will produce an end carry rn, which can be discarded. What is left is the M – N 3) If M < N, the sum does not produce an end carry and is equal to rn – (N – M), which is the rn complement of (N – M). To obtain the answer in a familiar form, take the r’s complement of the sum and place a negative sign in front. EX – 7 Using 10’s complement, subtract 72532 ‐ 3250. Here M = 72532 and N = 3250. M has five digits and N has only four digits. Both numbers must have the same number of digits, so we write N as 03250. Taking the 10’s complement of N produces a 9 in the most significant position.