Presentation is loading. Please wait.

Presentation is loading. Please wait.

MMNSS COLLEGE,KOTTIYAM DEPARTMENT OF PHYSICS

Similar presentations


Presentation on theme: "MMNSS COLLEGE,KOTTIYAM DEPARTMENT OF PHYSICS"— Presentation transcript:

1 MMNSS COLLEGE,KOTTIYAM DEPARTMENT OF PHYSICS
DIGITAL ELECTRONICS

2 Digital devices are based on electronic circuitry It represents two states 1 or high & 0 or low In this system, terms like bit, nibble & byte are frequently used

3 NUMBER SYSTEMS

4 Objectives After studying this chapter, You should be able to:
Understand the concept of number systems. Distinguish between non-positional and positional number systems. Describe the decimal, binary, hexadecimal and octal system. Convert a number in binary, octal or hexadecimal to a number in the decimal system. Convert a number in the decimal system to a number in binary, octal and hexadecimal. Convert a number in binary to octal and vice versa. Convert a number in binary to hexadecimal and vice versa. Find the number of digits needed in each system to represent a particular value.

5 2-1 INTRODUCTION A number system defines how a number can be represented using distinct symbols. A number can be represented differently in different systems. For example, the two numbers (2A)16 and (52)8 both refer to the same quantity, (42)10, but their representations are different. Several number systems have been used in the past and can be categorized into two groups: positional and non-positional systems. Our main goal is to discuss the positional number systems, but we also give examples of non-positional systems.

6 Common Number Systems System Base Symbols Used by humans?
Used in computers? Decimal 10 0, 1, … 9 Yes No Binary 2 0, 1 Octal 8 0, 1, … 7 Hexa- decimal 16 0, 1, … 9, A, B, … F

7 Quantities/Counting (1 of 3)
Decimal Binary Octal Hexa- decimal 1 2 10 3 11 4 100 5 101 6 110 7 111

8 Quantities/Counting (2 of 3)
Decimal Binary Octal Hexa- decimal 8 1000 10 9 1001 11 1010 12 A 1011 13 B 1100 14 C 1101 15 D 1110 16 E 1111 17 F

9 Quantities/Counting (3 of 3)
Decimal Binary Octal Hexa- decimal 16 10000 20 10 17 10001 21 11 18 10010 22 12 19 10011 23 13 10100 24 14 10101 25 15 10110 26 10111 27 Etc.

10 Conversion Among Bases
The possibilities: Decimal Octal Binary Hexadecimal

11 Quick Example 2510 = = 318 = 1916 Base

12 Decimal to Decimal (just for fun)
Octal Binary Hexadecimal

13 Weight 12510 => 5 x 100 = x 101 = x 102 = Base

14 Binary to Decimal Decimal Octal Binary Hexadecimal

15 Binary to Decimal Technique
Multiply each bit by 2n, where n is the “weight” of the bit The weight is the position of the bit, starting from 0 on the right Add the results

16 Example Bit “0” => 1 x 20 = x 21 = x 22 = x 23 = x 24 = x 25 = 32 4310

17 Octal to Decimal Decimal Octal Binary Hexadecimal

18 Octal to Decimal Technique
Multiply each bit by 8n, where n is the “weight” of the bit The weight is the position of the bit, starting from 0 on the right Add the results

19 Example 7248 => 4 x 80 = x 81 = x 82 =

20 Hexadecimal to Decimal
Octal Binary Hexadecimal

21 Hexadecimal to Decimal
Technique Multiply each bit by 16n, where n is the “weight” of the bit The weight is the position of the bit, starting from 0 on the right Add the results

22 Example ABC16 => C x 160 = 12 x 1 = B x 161 = 11 x 16 = A x 162 = 10 x 256 = 2560 274810

23 Decimal to Binary Decimal Octal Binary Hexadecimal

24 Decimal to Binary Technique Divide by two, keep track of the remainder
First remainder is bit 0 (LSB, least-significant bit) Second remainder is bit 1 Etc.

25 Example 12510 = ?2 12510 =

26 Octal to Binary Decimal Octal Binary Hexadecimal

27 Octal to Binary Technique
Convert each octal digit to a 3-bit equivalent binary representation

28 Example 7058 = ?2 7058 =

29 Hexadecimal to Binary Decimal Octal Binary Hexadecimal

30 Hexadecimal to Binary Technique
Convert each hexadecimal digit to a 4-bit equivalent binary representation

31 Example 10AF16 = ?2 A F 10AF16 =

32 Decimal to Octal Decimal Octal Binary Hexadecimal

33 Decimal to Octal Technique Divide by 8 Keep track of the remainder

34 Example = ?8 8 19 2 8 2 3 8 0 2 = 23228

35 Decimal to Hexadecimal
Octal Binary Hexadecimal

36 Decimal to Hexadecimal
Technique Divide by 16 Keep track of the remainder

37 Example = ?16 77 2 16 = D 0 4 = 4D216

38 Binary to Octal Decimal Octal Binary Hexadecimal

39 Binary to Octal Technique Group bits in threes, starting on right
Convert to octal digits

40 Example = ?8 = 13278

41 Binary to Hexadecimal Decimal Octal Binary Hexadecimal

42 Binary to Hexadecimal Technique Group bits in fours, starting on right
Convert to hexadecimal digits

43 Example = ?16 B B = 2BB16

44 Octal to Hexadecimal Decimal Octal Binary Hexadecimal

45 Octal to Hexadecimal Technique Use binary as an intermediary

46 Example 10768 = ?16 E 10768 = 23E16

47 Hexadecimal to Octal Decimal Octal Binary Hexadecimal

48 Hexadecimal to Octal Technique Use binary as an intermediary

49 Example 1F0C16 = ?8 1 F C 1F0C16 =

50 BINARY ADDITION The following table gives the rules for binary addition. When 1 is added to 1 the sum is 10(binary)=2(decimal) A B A+B 1 10

51 1 In the above example when 1 is added to 1,there is a carry=1.This carry is added to the sum of the adjacent bits

52 Example 2 1

53 Binary Subtraction When 1 is subtracted from 0,there is a borrow from the adjacent bit
1

54 1’sComplement. The 1’s complement of a binary number is obtained by subtracting each bit of the number from 1. It is simply obtained by changing each bit 1 to zero and zero to 1 Binary number 1’s complement 100110 111110 011001 000001

55 2’s complement The 2’s complement of a binary number=its 1’s complement+1
10011 01100 +1 (00001) 01101 111 000 +1(001) 001 0000 1111 +1(0001) 010110 101001 +1(000001) 101010

56 Addition of a binary number to its 2’s complement
Addition of a binary number to its 2’s complement. (In this case, the last carry is lost for a 4 bit processor) Binary number 1’s complement 2’s complement Number+2’s complement 1001 0110 0110+1=0111 1001 + 0111 0000 (carry 1 is lost)

57 Representation of numbers in 1’s complement
Positive numbers are represented by including a zero at the extreme left. The negative numbers are represented by the complemented value of the positive signed binary. Example. +(6)10 is represented by (0110)2 -(6)10 is represented by (1001)2,the 1’s complement of (0100)2

58 Addition &Subtraction Using 1’s Complement
There are four possibilities 1.Both the numbers are positive 2.One number is positive and the other number is negative, the negative number being greater 3.One number is positive and the is negative, the positive number being greater. 4.Both the numbers are negative.

59 Decimal representation
Case 1. Add and +0100 Normal form Representation Decimal representation + 0011 0 0011 +3 + 0100 0 0100 +4 +0111 0 0111 + 7

60 Case II:One number is positive & the other number is negative, the negative number being greater. When a positive number is added to a larger negative number, the sum is the difference of the two numbers with sign of the negative number. The negative number is represented as its 1’s complement and is added to the positive number. The answer will be the complement of the sum. Normal form Representation Decimal representation + 0101 0 0101 +5 - 1100 1 0011 -12 -0111 1 1000 -7

61 The answer is therefore the complement of 1000 which is --0111
In the above example when the larger number is subtracted from the smaller number the result is in complemental form. The answer is therefore the complement of which is 1100 -0101 0111

62 Case 3: When the positive number is greater, the end around carry generated should added to get the final sum. The result directly gives the sum. (no complementing needed).Example add 1110 and -1001 Normal representation Binary representation Decimal representation + 1110 0 1110 14 -1001 1 0110 -9 +0101 (carry 1) 0 0001 0 0101 +5

63 Case 4: When both numbers are negative
Case 4: When both numbers are negative. In this case there will be an end around carry since the numbers are added in 1’s complement form. The carry should be added to the sum.The result will be in 1’s complement form Normal representation Binary representation Decimal representation -0011 1 1000 -3 -1011 1 0100 -11 -1110 with carry 1 1 1 0001 The final sum is the complement of the above ie -14

64 Addition and Subtraction using 2’s complement
The addition of two positive numbers using 2’s complement representation is the same as the one described in 1’s complement method .If the numbers are opposite in sign, the method is different. If the larger number is positive, add the 2’s complement of the smaller negative number to the larger number and ignore the carry Decimal Binary 2’s complement form +9 1001 0 1001 -8 -1000 1 1000 +1 0001 1 0001 Ignore the carry The answer is

65 If the larger number is negative take its 2’s complement and add to the smaller positive number. It is seen that there is no carry. The sum is in 2’s complement form. To get the answer, take the 2’s complement and change the sign Decimal Binary 2’s complement method +17 10001 -18 -10010 -1 -00001 11111 The sum is negative and is the 2’s complement of the answer. Taking the 2’s complement of the above number

66 FRACTIONAL NUMBERS 1.To convert a fractional decimal number in to binary repeatedly multiply the number by two. 2.The integer part of the product of the first multiplication gives the MSB. 3.The fractional part is again multiplied by two and the integer part of the product gives the next bit. 4.The process is repeated till the product is zero. The last bit retained is the LSB

67 Convert 0.812510 in to binary. The operation is tabulated as follows
Fractional number Product Fractional part Carry 0.8125x2 1.6250 0.6250 1 MSB 0.6250x2 1.2500 0.2500 1 0.2500x2 0.5000 0.5000x2 1.0000 0.0000 The binary equivalent of (0.8125)10 is

68 Convert in to decimal =1x(1/2)+1x(1/4)+0x(1/8)+1x(1/16) =(1/2)+(1/4)+0+(1/16) = =0.8215

69 Convert 0.312510 in to binary Fractional number Product
Fractional part Carry 0.3125x2 0.6250 MSB 0.6250x2 1.2500 0.2500 1 0.2500x2 0.5000 .05000x2 1.0000 0.0000 The required binary number

70 Binary Coded Decimal Representation of decimal numbers using binary digits is defined as the binary coded decimal or BCD It is a weighted code The successive digits from right to left have specified weights The required number can be obtained by adding the products of the weights with the corresponding binary digit

71 Example of BCD: 8421 code This is a 4 bit BCD code
The binary weights of the four bits are represented as 2³,2²,2¹, and 2 In 8421 code 16 combinations can be represented. Only 10 combinations are used to represent the decimal digits. The six combinations 1010,1011,1100,1101,1110,1111 are illegal

72 A decimal number can be expressed in BCD by simply replacing the digits with the corresponding 4 bit code Decimal 8421 code 5 0101 12 38.5


Download ppt "MMNSS COLLEGE,KOTTIYAM DEPARTMENT OF PHYSICS"

Similar presentations


Ads by Google