Summary

This document provides an overview of number systems, focusing on their representation, conversions, and basic concepts. It explains various types of number systems, including decimal, binary, octal, and hexadecimal systems.

Full Transcript

NUMBER SYSTEMS The study of number systems is important from the viewpoint of understanding how data are represented before they can be processed by any digital system including a digital computer. It is one of the most basic topics in digital electronics. o Decimal number...

NUMBER SYSTEMS The study of number systems is important from the viewpoint of understanding how data are represented before they can be processed by any digital system including a digital computer. It is one of the most basic topics in digital electronics. o Decimal number system o Binary o Octal, o Hexadecimal Analogue Versus Digital Two basic ways of representing the numerical values of the various physical quantities with which we constantly deal in our day-to-day lives. One of the ways, referred to as analogue, is to express the numerical value of the quantity as a continuous range of values o For example, the temperature of an oven settable anywhere from 0 to 100 °C may be measured to be: o 65 °C or 64.96 °C or 64.958 °C or even 64.9579 °C Digital, represents the numerical value of the quantity in steps of discrete values. The numerical values are mostly represented using binary numbers. For example, the temperature of the oven may be represented in steps of 1 °C as 64 °C, 65 °C, 66 °C SYSTEMS: o Analogue systems contain devices that process or work on various physical quantities represented in analogue form. o Digital systems contain devices that process the physical quantities represented in digital form. -Digital techniques and systems have the advantages of being; o Relatively much easier to design o Higher accuracy o Programmability o Noise immunity o Easier storage of data o Ease of fabrication in integrated circuit form, -This leads to availability of more complex functions in a smaller size The real world, however, is analogue. Most physical quantities – position, velocity, acceleration, force, pressure, temperature and flow rate, for example – are analogue in nature. That is why analogue variables representing these quantities need to be digitized or discretized at the input if we want to benefit from the features and facilities that come with the use of digital techniques. Introduction to Number Systems Different characteristics that define a number system include : The number of independent digits (symbols) used in the number system. The place values of the different digits constituting the number. The maximum numbers that can be written with the given number of digits. o Among the three characteristic parameters, the most fundamental is the number of independent digits or symbols used in the number system. o It is known as the radix or base of the number system. The decimal number system with which we are all so familiar can be said to have a radix of 10 as it has 10 independent digits, i.e. 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9. Similarly, the binary number system with only two independent digits, 0 and 1, is a radix-2 number system. The octal and hexadecimal number systems have a radix (or base) of 8 and 16 respectively. The place values of different digits in the integer part of the number are given by r0, r1, r2, r3, …… and so on, starting with the digit adjacent to the radix point. For the fractional part, these are r-1, r-2, r-3….. o Maximum numbers that can be written with n digits in a given number system are equal to rn Decimal Number System The decimal number system is a radix-10 number system and therefore has 10 different digits or symbols. These are 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9. All higher numbers after ‘9’ are represented in terms of these 10 digits only. The process of writing higher-order numbers after ‘9’ consists in writing the second digit (i.e. ‘1’) first, followed by the other digits, one by one, to obtain the next 10 numbers from ‘10’ to ‘19’. The next 10 numbers from ‘20’ to ‘29’ The place values of different digits in a mixed decimal number, starting from the decimal point, are: 100, 101, 102..and so on (for the integer part) and 10-1, 0-2, 10-3 and so on (for the fractional part). The decimal number 3586.265, the integer part (i.e. 3586) can be expressed as and the fractional part can be expressed as Binary Number System The binary number system is a radix-2 number system with ‘0’ and ‘1’ as the two independent digits. All larger binary numbers are represented in terms of ‘0’ and ‘1’. The procedure for writing higher order binary numbers after ‘1’ is similar to the one explained in the case of the decimal number system. For example, the first 16 numbers in the binary number system would be 0, 1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010, 1011, 1100, 1101, 1110 and 1111. Starting from the binary point, the place values of different digits in a mixed binary number are: 20, 21, 22. and so on (for the integer part) 2-1, 2-2, 2-3,.. and so on (for the fractional part). Octal Number System The octal number system has a radix of 8 and therefore has eight distinct digits. All higher-order numbers are expressed as a combination of these on the same pattern as the one followed in the case of the binary and decimal number systems The independent digits are 0, 1, 2, 3, 4, 5, 6 and 7. The next 10 numbers that follow ‘7’, for example, would be 10, 11, 12,13, 14, 15, 16, 17, 20 and 21. o The place values for the different digits in the octal number system are: o 80,81,82 and so on (for the integer part) and o 8-1, 8-2, 8-3 and so on (for the fractional part). Hexadecimal Number System The hexadecimal number system is a radix-16 number system and its 16 basic digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F. The place values or weights of different digits in a mixed hexadecimal number are: 160 161, 162..and so on (for the integer part) and 16-1, 16-2, 16-3..and so on (for the fractional part). The decimal equivalent of A, B, C, D, E and F are 10, 11, 12, 13, 14 and 15 respectively. Binary Number System Bit is an abbreviation of the term ‘binary digit’ and is the smallest unit of information. It is either ‘0’or ‘1’. A byte is a string of eight bits. The byte is the basic unit of data operated upon as a single unit in computers. A computer word is again a string of bits whose size, called the ‘word length’ or ‘word size’, is fixed for a specified computer, although it may vary from computer to computer. The word length may equal one byte, two bytes, four bytes or be even larger. The 1’s complement of a binary number is obtained by complementing all its bits, i.e. by replacing 0s with 1s and 1s with 0s. For example, the 1’s complement of (10010110) 2 is (01101001)2. The 2’s complement of a binary number is obtained by adding ‘1’ to its 1’s complement. The 2’s complement of (10010110) 2 is (01101010)2 Decimal Number System Corresponding to the 1’s and 2’s complements in the binary system, in the decimal number system we have the 9’s and 10’s complements. The 9’s complement of a given decimal number is obtained by subtracting each digit from 9. For example, the 9’s complement of (2496)10 would be (7503)10. The10’s complement is obtained by adding ‘1’ to the 9’s complement. The 10’s complement of (2496)10 is (7504)10 Octal Number System In the octal number system, we have the 7’s and 8’s complements. The 7’s complement of a given octal number is obtained by subtracting each octal digit from 7. For example, the 7’s complement of (562)8 would be (215)8. The 8’s complement is obtained by adding ‘1’ to the 7’s complement. The 8’s complement of (562)8 would be (216)8. Hexadecimal Number System The 15’s and 16’s complements are defined with respect to the hexadecimal number system. The 15’s complement is obtained by subtracting each hex digit from 15. For example, the 15’s complement of (3BF) would be (C40). 16 16 The 16’s complement is obtained by adding ‘1’ to the 15’s complement. The 16’s complement of (2AE) would be (D52). 16 16 Sign-Bit Magnitude In the sign-bit magnitude representation of positive and negative decimal numbers, The MSB represents the ‘sign’, with a ‘0’ denoting a plus sign and a ‘1’ denoting a minus sign. The remaining bits represent the magnitude. In eight-bit representation, while MSB represents the sign, the remaining seven bits represent the magnitude. For example, the eight-bit representation of +9 would be 00001001, and that for -9 would be 10001001 1’s Complement In the 1’s complement format, the positive numbers remain unchanged. The negative numbers are obtained by taking the 1’s complement of the positive counterparts. For example, +9 will be represented as 00001001 in eight-bit notation, and -9 will be represented as 11110110, which is the 1’s complement of 00001001. Challenge: +0 = 00000000; -0 = 11111111 2’s Complement In the 2’s complement representation of binary numbers, the MSB represents the sign, with a ‘0’used for a plus sign and a ‘1’ used for a minus sign. The remaining bits are used for representing magnitude. Positive magnitudes are represented in the same way as in the case of sign-bit or 1’s complement representation. Negative magnitudes are represented by the 2’s complement of their positive counterparts. For example, +9 would be represented as 00001001, and -9 would be written as 11110111. BINARY ADDITION 0+0 = 0 Addition of negative numbers done using 0+1 = 1 complement form 1+0 = 1 for the negative number. 1+1 = 10 Makes it easier ADDITION USING 1’S & 2’S COMPLEMENT Using one complement: Using 2’s complement: 3-2 +3 (0000 0011) 3+(-2) -2 1’s comp. (1111 1101) +3 (0000 0011) -2 2’s complement add 1 to 1’s +2 (0000 0010) comp (1111 1110) -2 1’s comp. (1111 1101) 3+(-2)=1 +3 (0000 0011) (0000 0011) =0 (1 0000 0000) (1111 1110) (wrong) 1 0000 0001) = 1 (correct) MSB is discarded. MSB is discarded. Decimal-to-Binary Conversion For the integer part, the binary equivalent can be found by successively dividing the integer part of the number by 2 and recording the remainders until the quotient becomes ‘0’. The remainders written in reverse order constitute the binary equivalent. For the fractional part, it is found by successively multiplying the fractional part of the decimal number by 2 and recording the carry until the result of multiplication is ‘0’. Decimal-to-Octal Conversion Decimal-to-Hexadecimal Conversion Binary–Octal and Octal–Binary Conversions Hex–Binary and Binary–Hex Conversions Hex–Octal and Octal–Hex Conversions Let us find the octal equivalent of (2F.C4)16 and the hex equivalent of (762.013)8

Use Quizgecko on...
Browser
Browser