Chapter I: Digital System and Binary Numbers

Loading...

Chapter I: Digital System and Binary Numbers 1-1Digital Systems Digital systems are used in: -

Communication

-

Business transaction

-

Traffic Control

-

Medical treatment

-

Internet

The signals in digital systems use just two discrete values: a binary digit. Binary digit called a bit, has two values: 0 or 1. Example: The decimal digits a through 9 are represented in digital system with a code of four bits (e.g. is represented by 0111, 8 is represented by 1000, 9 is represented by 1001).

1-2 Binary Numbers •

Decimal number:

The decimal number system is said to be of base, or radix, 10 because it uses 10 digits (0, 1, 2, 3, 4, 5, 6, 7, 8, 9). Example1: The decimal number 245 may be written as 2x102+4x101+5x100 where 2, 4, and 5 are the coefficients. Example2: The decimal number 245.25 may be written as 2x102 + 4x101+5x100 + 2x10-1 + 5x10-2 •

Binary Number System:

The coefficients of the binary number have only two possible values: 0 or 1. Example: (111)2 its equivalent decimal number is : 1x22+1x21+1x20 = 4 + 2 + 1 = 7, where 1, 1, and 1 are the coefficients. (1001)2 its equivalent decimal number is : 1x23+0x22+0x21+1x20 = 8 + 0 + 0 + 1 = 9 where 1, 0, 0, and 1 are the coefficients. (1101.11)2 its equivalent decimal number is :

1x23 + 1x22 + 0x21 + 1x20 + 1x2-1 + 1x2-2 = 8 + 4 + 0 + 1 +0,5 + 0.25 = 13.75 In general, a number expressed in a base r system has coefficients multiplied by powers of r. an.rn + an-1.rn-1 +………+ a2.r2 + a1.r1 + a0 + a-1.r-1 + a-2.r-2 +………..+ a-m.r-m The coefficient aj coefficient rang in value from 0 to r-1. To distinguish between numbers of different bases, the coefficients are enclosed in parentheses and write a subscript equal to the based used (except sometimes for decimal number). •

Hexadecimal number system (Base 16):

It uses 16 digits : (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F). The letter A, B, C, D, E, and F are used for the digits 10,11, 12, 13, 14, and 15 respectively. Example: (124)16 = 1x162 + 2x161 + 4x160 = 256 + 32 + 4 = 292 (B32A)16 = 11x163 + 3x162 + 2x161 + 10x160 = 45056 + 768 + 32 + 10 = 45866

1-3 Number-Base conversions The conversion of a number in base r is done by expanding the number in a power series and adding all terms. Example1: (24)8 = 2x81 + 4x80 = (18)10 = 18 •

Conversion of a decimal integer

The conversion of a decimal integer to a number in base r is done by dividing the number and all successive quotients by r and accumulation the remainders. Example2: Convert decimal 41 to binary. Dividing by 2 41 20

1

10

0

5

0

2

1

1

0

0

1

Æ

result reading

(41)10 = (101001)2

Example3: Convert decimal 153 to octal. Dividing by 8 153



19

1

2

3

0

2

Æ

(153)10 = (231)8

result reading

Conversion of a decimal fraction

The conversion of a decimal to a binary is accomplished by a method similar to that used for integers. However, multiplication is used instead of division, and integers instead of remainders are accumulated. Example4: Convert (0.6875)10 to binary, Integer

fraction

coefficient

0.6875x2

=

1

+

0.375

a-1 = 1

0.375x2

=

0

+

0.75

a-2 = 0

0. 75x2

=

1

+

0.5

a -3 = 1

0.5x2

=

1

+

0

a-4 = 1

Therefore, the answer is (0.6875)10 = (0.1011)2

1-4 Conversion from binary to hexadecimal and to octal - The conversion from and to binary, octal, and hexadecimal plays an important role in digital computers. Each octal digit corresponds to three binary digits. Each hexadecimal digit corresponds to four binary digits. - The first 16 numbers in decimal, binary, octal, and hexadecimal number systems are listed in table1.

Decimal Binary Octal Hexadecimal 0 0000 0 0 1 0001 1 1 2 0010 2 2 3 0011 3 3 4 0100 4 4 5 0101 5 5 6 0110 6 6 7 0111 7 7 8 1000 10 8 9 1001 11 9 10 1010 12 A 11 1011 13 B 12 1100 14 C 13 1101 15 D 14 1110 16 E 15 1111 17 F Table1: Numbers with different bases Example1: Convert binary 1111100110011 to octal and to hexadecimal. -

Binary to octal:

Starting from the left and partitioning the binary number into groups of three digits each, then assign the corresponding octal digit to each group. ( 001 111 100 110 011)2 = (17463)8 -

Binary to Hexadecimal:

Conversion from binary to Hexadecimal is similar, except thr binary number is divided into groups of four digits. (0001

1111 0011

0011)2 = (1F33)16

Example2: Convert the following numbers. (110111001.110111)2 = ( ? )8 (110111001.110111)2 = ( ? )16 Solution: (110 111 001 . 110 111)2 = (671.67)8 (0001 1011 1001 . 0011 0111)2 = (1B9.37)16

1-5 Conversion from octal or hexadecimal to binary This conversion is done by reversing the preceding procedure. Each octal digit is converted to its three digits binary and each hexadecimal digit is converted to its four digits binary. Example: (436)8 = (100 011 110)2 (52.67)8 = (101 010 . 110 111)2 (B79A)16 = (1011 0111 1001 1010)2

1-5 Complements Complements are used in digital computers to simplify the subtraction operation and for logical manipulation. Each base-r-system has two types of complements: -

The radix complement: r's Complement.

-

The diminished complement: (r-1)'s complement.

For base 2, the two types are: 2's Complement and 1's Complement. For base 10, the two types are: 10's Complement and 9's Complement. - Diminished radix 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 numbers, r =10 and r-1 = 9, so, the 9's Complement of N is (10n-1) – N Example: Find the 9's Complement of 64785. The number 64785 has 5 digits (n = 5), the 9's Complement is : (105-1) – 64785 = 99999 – 64785 = 35214 - For binary numbers, r =2 and r-1 = 1, so, the 1's Complement of N is (2n-1) – N. Important: 2n is represented by a binary number that consists of a 1 followed by n 0's. e.g. : 25 = (100000) 2 ; 24 = (10000) 2. 2n-1 is binary number represented by n 1's. e.g. : 25-1 = (11111)2 ; 24 = (1111) 2. Example: Find the 1's Complement of 10011000 Solution:

N=8 so, the 1's Complement of 10011000 is: (28-1) - (10011000) = (11111111) – (10011000) = 01100111 The 1's Complement can be obtained more easily by changing 1's to 0's and 0's to 1's as follow: The 1's Complement of 10011110 is 01100001 The 1's Complement of 111100 is 000011 - Radix Complement: The r's Complement of an n digits number N in base r is defined as rn – N for N ≠ 0 and as 0 for N = 0. Comparing with (r-1)'s Complement, we can write: r's Complement = (r-1)'s Complement + 1. Thus the 2's Complement of binary is obtained by adding 1 to the 1's Complement value. Example: The 2's Complement of binary 101100 is :

010011 + 1 010100

1's Complement

The 2's Complement can be obtained by leaving all least significant 0's and the first 1 unchanged and replacing 1's with 0's and 0's with 1's in all other significant digits. Example:

The 2's Complement of 111001100 is:

000110 1 00

All other significant bits are changed

Two least significant 0: unchanged First 1 unchanged

- Subtraction with Complement:

The subtraction of two n digits unsigned numbers M-N in base r can be done as follow. 1-

Add the minuend M to the r's Complement of the subtrahend N.

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 result M – N. 3-

If M < N, the sum does not produce an end carry and is equal to rn – (M – N)

which is the r's Complement of (M – N). To obtain the r's complement of the sum and place a negative sign in front.

Example: Given the two binary numbers X = 1010100 and Y = 1000011, perform the substraction: a-

X-Y

b-

Y – X by using 2's Complement Solution:

aX = 1010100 2' s Complement of Y = L + 0111101 Sum = 10010001 Discard end carry 2 7 = − 10000000 AnswerX − Y = 0010001 b-

Y = 1000011 2' s Complement of X = + 0101100 Sum = 1101111

There is no end carry. Therefore, the answer is: Y – X = - (2's Complement of 1101111) = - 0010001 Substraction of unsigned numbers can also be done by means of the 1's

-

Complement: a-

X – Y = 1010100 – 1000011

X 1' s Complement of Y Sum End around carry Answer X − Y b-

= = = = =

1010100 + 0111100 10010000 1 + 0010001

Y – X = 1000011 - 1010100

Y = 1' s Complement of X = Sum =

1000011 + 0101011 1101110

There is no carry. Therefore, the answer is: Y – X = - (1's Complement of 1101110) = -0010001

1-6 Signed Binary Numbers - Positive Integer can be represented as unsigned numbers. - Negative integers, are represented by using a signed complement system which can use either 1's complement or 2's complement but the 2's complement is the most common. The convention is to make the sign bit the sign bit 0 for positive and 1 for negative. - As an example, consider the number 9, represented in binary with eight bits. +9 = 00001001 -9 = 11110111 (By using 2's complement) Arithmetic Addition: To add two signed binary numbers, the negative number must be initially in 2's complement form and that if the sum obtained after the addition is negative, it's in 2's complement form

Loading...

Chapter I: Digital System and Binary Numbers

Chapter I: Digital System and Binary Numbers 1-1Digital Systems Digital systems are used in: - Communication - Business transaction - Traffic Con...

164KB Sizes 7 Downloads 23 Views

Recommend Documents

Digital Logic Design Unit-I Digital system and binary numbers
ECS-301 : Digital Logic Design. Unit-I. Digital system and binary numbers: : Signed binary numbers, binary codes, cyclic

Digital System And Binary Numbers - Unacademy
This course would contain basics of the digital system starting from number system, conversion from one form to another

Tech Blog: Digital System and Binary Numbers
Jul 22, 2010 - I have got many emails from students regarding Digital System and Binary Numbers conecpts so this is quic

Chapter 1 Digital Systems and Binary Numbers | Binary Coded
Digital Logic Design I. Chapter 1. Digital Systems and Binary Numbers. Title: Digital Design Code: Lecture: 3. Pre-Requi

Digital Systems and Binary Numbers
Digital Systems. ▫ Binary Numbers. ▫ Number-Base Conversions. ▫ Octal and Hexadecimal Numbers. ▫ Complements. â–

Digital Systems and Binary Numbers
[PDF]Digital Systems and Binary Numbershttp://eclass.duth.gr/.../Pages%20from%20DIGITAL%20SYSTEM%20DESIGN%20...CachedTh

Di i l S gital System Chapter 1 Digital Systems and Binary Numbers
Di i l S gital System Chapter 1 Digital Systems and Binary Numbers Read more about digital, binary, complement, logic, d

Chapter 1: Digital Systems and Binary Numbers - PDF - DocPlayer.net
Chapter 1: Digital Systems and Binary Numbers Digital age and information age Digital computers general purposes many sc

PPT – Chapter 1 Digital Systems and Binary Numbers PowerPoint
Electronic calculators, PDA's. Digital TV. Discrete information-processing systems ... Decimal (Fraction) to Binary Conv

Digital Data and Binary Numbers - web.pdx.edu
1. Digital Data and Binary Numbers. 1.Digital Data. 2. Binary numbers. 3. How digital data is displayed on the monitor.