Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chap 1 Digi g al Systems and Binary Numbers 1.1 Digita l Systems 1.2 Binary Numbers 1.3 Number-Base Conversions 1.4 Octal a n d h exad e cimal Numbers.

Similar presentations


Presentation on theme: "Chap 1 Digi g al Systems and Binary Numbers 1.1 Digita l Systems 1.2 Binary Numbers 1.3 Number-Base Conversions 1.4 Octal a n d h exad e cimal Numbers."— Presentation transcript:

1

2 Chap 1 Digi g al Systems and Binary Numbers 1.1 Digita l Systems 1.2 Binary Numbers 1.3 Number-Base Conversions 1.4 Octal a n d h exad e cimal Numbers 1.5 Complemen t s 1.6 Signed Bi n ary N um bers 1.7 Binary Codes 2

3 Chap 1 1.2 Binary Numbers In gene r al, a number expressed in a base- r system has coefficien t s multiplied by powers of r : a nn -110-1-2- m r+ar+a n  r +…+ a n -1 r+ar+a 1 +a+a r+ar+a -1  r +…+ a -2 rr -m-m r is called b ase or radi x. 3

4 In genera x, a number expressed in a base- r sys x em ha x coefficien x s multiplied by powers of r : a nn -110-1-2- m r is called base or radix. r+ar+a n  r +…+ a n -1 r+ar+a 1 +a+a rxarxa -1  r +…+ a -2 rr -m-m 4

5 C h ap 1 1.2 Binary Numbers 5 Arithmetic Operation 1-Addition augend 101101 Added: + 100111 ------------- Sum: 1010100

6 C h ap 1 1.2 Binary Numbers 6 Arithmetic Operation 2-Subtraction minuen: 101101 subtrahend: - 100111 ------------- difference: 000110

7 C h ap 1 1.2 Binary Numbers 7 Arithmetic Operation 3-Multiplication multiplicand: 1011 multiplier: x 101 ------------- 1011 0000 1011 -------------- Product: 110111

8 Chap 1 1.3 Number-Base Conversions Example1.1C o nvert decimal 41 to binary, (41) 102 = (?) (41) DBDB = (?) Example1.2(153) 108 = (?) Example1.3(0.6875) 102 = (?) Examp x e1.4(0. 5 13) 108 = (?) 8

9 Chap 1 1.4 Octal a nd Hexadecimal Nu m bers S e e Table 1.2 9

10 Text Book: Digi x al Design 4th Ed. Chap 1 1.4 Oc x al and Hexadecimal Numb x rs See T x ble 1.2 10

11 Chap 1 1.5 Complements Diminished Radi x Compl e ment Given a number N in base r having n digits, the ( r - 1)’s complement o f N is defined as ( r - 1) - N. n t he 1’s com p lement of 1011000 is 0100111 11 t he 9’s com p lement of 012398 is 999999 – 012398=987601 t he 9’s com p lement of 546700 is 999999 – 546700=453299 t he 1’s com p lement of 0101101 is 1010010

12 Chap 1 1.5 Complements Diminished Radi x Compl e ment 12 The (r-1)’s complement of octal or hexadecimal numbers is obtained by subtracting each digit from 7 or F(decimal 15),respectively

13 Chap 1 1.5 Complements Radix Com b lement 13 The 10’s complement of 012398 is 987602 And The 10’s complement of 246700 is 753300 Given a number N in base r having n digit, the r ’s comp l ement of N is defined as r - N for N ≠ 0 and as 0 for N = 0. n The 2 ’s complement of 1011000 is 01 0 1000

14 Chap 1 1.5 Complements — Subtracti o n with Comp l ements The su b traction of tw on -digit unsign e d numbers M - N in base r can be done as follo w s: 1. M + ( r - N ), note tha t ( r - N ) is r ’s complemen t of N. nn 2. If M  N, the sum will produce a n end carry x, which ca nb e d iscarded; what is left is the re s ult M - N. n 3. If M < N, the sum does not produce an end carr ya nd is equal to r - ( N - M ), which is r ’s complement of n ( N - M ). Take the r ’ x complement of the su m and place a n egative sign in front. 14

15 Chap 1 1.5 Compl e ments — Subtraction with Com p lem e nts Example 1. 5 Using 10’s complement, subtr ac t 72532 - 3250. 1. M = 72532, N = 3250, 10’s com p lement of N = 96750 2. 3. answer: 69282 72532 augend  96750  addend 169282 .... sum  15 Discarded end carry 10 5 =-100000

16 C hap 1 1.5 Complements — Subtraction with Complement s Example 1.6Using 10’s complement, subtract 3250 - 72 5 32. 1. M = 3250, N = 72532, 1 0 ‘ s complemen t of N = 27468 2. 3. answer: -(100000 - 30718) = -69282 03250  27468 30718 16

17 C hap 1 1.5 Complements — Subtraction with Complements Example 1.7Using 2’s complement, subtract 1 010100 - 1000011. 1. M = 1010100, N = 1000011, 2’s complem e nt of N = 0111101 2. 3. answer: 0010001 1010100  0111 1 01 100 1 0001 17 Discarded end carry 2 7 =-10000000

18 C hap 1 1.5 Complements — Subt r action wit h Complements Example 1.7-bUsing 2’s com p lement, subtract 1000011 - 1010100. 1. M = 1000011, N = 1010100, 2’s complem p nt of N = 01 0 1100 2. 3. answer: - (10000000 - 1101111) = -0010001 1000011  01011 0 0 110 11 11 18 No end carry

19 Chap 1 1.5 Complements — Subtraction with Complem p nts Examp l e 1.8Using 1’s c o mple m ent, s u btract 1010100 - 1000 0 11. 1. M = 101010 0, N = 1000011, 1’s complement of N = 0111100 2. 3. ans w er: 0010001 ( r carry, call end-around carry) n 1010100  0111100 10010000 19

20 Chap 1 1.5 Compl e ments — Subtraction with Complements Ex a m p l e 1.8-b : Using 1’s complement, subt r act 1000011 - 1 010100. 1. M = 1000011, N = 10 1 0 1 00, 1’s complement of N = 0101011 2. 3. A nswer: -0010001 1000011  0101011 11 0 1110 20

21 Chap 1 1.6 Signe d Bi n ary Numbers Next table shows sig n ed binary numbers 21 The Left most bit 1 represent the negative number in binary representation The Left most bit 0 represent the positive number in binary representation

22 Chap 1 1.6 Signe d Bi n ary Numbers Next table shows sig n ed binary numbers 22 One way to represent +9 in 8-bit allocation is :00001001 But Three ways to represent -9 in 8-bit allocation are: Sign-and magnitude representation: 10001001 Signed-1’s complement representation: 11110110 Signed-2’s complement representation: 11110111

23 Text B x ok: Digital Design 4th Ed. Chap 1 1.6 Signed Binary Numbers Arithmetic addition Arithmetic subtraction See nex xx able 23

24 Chap 1 1.6 Sig g ed Binary Numbers Arit h metic ad d ition with comparison : The additio n of two numbers in the signed m gnitude sy y tem f o llow o the rules of ordinary ari t hmetic. If the signed are the same, we add the two magnitudes and give the sum th e commo n sign. If the signed are different, w e subt r act the s m aller m a gnitude from the larger and give the difference the sign of the larger magnitude. EX. (+25) + (-38) = -(38 - 25) = - 1 3 24

25 Arithmetic addition without comparison : The addition of two sign e d binary number w ith negative numbers represented in signed 2’s compl e ment form is obtained from the a d dition of the two numbers, including their signedbits. A carry out of the signed bit position is discarded (note that the 4th case). See examples in next page. Chap 1 1.6 Signed Binary Numbers 25

26 Chap 1 1.6 Signe n Bina r y Numbers A r ithmetic addition without comparison : 1911101101 1311110011 0611111010 0711111001 1311110011 0600000110 0700000111 13000011 0 1 061 1 111010 1900010011 1300001101 0600000110                        26

27 Chap 1 1.6 Signe n Bina r y Numbers A r ithmetic Subtraction 27 (+/-) A – (+B)= (+/-) A + (-B) (+/-) A – (-B)= (+/-) A + (+B) Example; (-6) – (-13)= +7 In binary: (1111010 – 11110011)= (1111010 + 00001101)= =100000111 after removing the carry out the result will be : 00000111

28 Chap 1 1.7 Binary Codes BCD (Bin a ry-Coded Decimal) CodeTable 1.4 Decimal codesTable 1. 5 (4 different Codes f or the Decimal Digits) Gray codeTable 1.6 ASCII c h aracter co d eTable 1.7 Error Detecting code 28

29 Text Book: Digital Design 4t x Ed. Chap 1 1.7 Binar x Codes B x D Code Decimal codes Gray code ASCII character code E x ror Detecting code See next tables 29

30 Chap 1 1.7 Binary Codes BCD (Bin a ry-Coded Decimal) A number with k decimal digits will require 4k bits in BCD Example: (185) 10 = (0001 1000 0101) BCD = (10111001) 2 30

31 Chap 1 1.7 Binary Codes BCD Addition Example: 4 0100 4 0100 8 1000 +5 +0101 +8 +1000 +9 +1001 --- --------- ---- -------- ---- --------- 91001 12 1100 17 10001 + 0110 + 0110 -------- ---------- 10010 10111 31

32 Chap 1 1.7 Binary Codes BCD Addition Example: 184+ 576 = 760 in BCD BCD 1 1 0001 1000 0100 184 +0101 0111 0110 +576 --------- -------- --------- 0111 10000 1010 add 6 + 0110 + 0110 ---------- -------- ---------- --------- 0111 0110 0000 760 32

33 Chap 1 1.7 Binary Codes Decimal Arithmatic Addition for signed numbers Example: (+375) + (- 240) = + 135 in BCD Apply 10‘s complement to the negative number only Addition is done by summing all digits,including the sign digit,and discarding the end carry 0 375 +9 760 ------------ 0 135 33

34 Chap 1 1.7 Binary Codes Decimal Arithmatic Subtraction for signed and unsigned numbers Apply 10‘s complement to the subtrahend and apply addition (same as binary case) 34

35 Text Book: Digit x l Design 4t x Ed. Chap 1 1.7 Binary Codes BC x Code Decimal c x des Gray code x SCII charact x r code Error Detecting code See next ta x les 35

36 Text Book: Digital Design 4th Ed. Chap 1 1.7 Bina xx Codes BCD Code Decimal codes Gr x y code ASCII character code Error Detecting x ode See x ext ta x les 36

37 Text Book: Digita x Design 4th Ed. x h x p 1 x.7 x inary Codes BCD x ode Deci x al codes Gray code ASCII character code Error Detecting code S x e next tables 37

38 Chap 1 1.7 Binary Codes Error Detecting code 38 with even parity with odd parity ASCII A 1000001 01000001 11000001 ASCII T 1010100 11010100 01010100


Download ppt "Chap 1 Digi g al Systems and Binary Numbers 1.1 Digita l Systems 1.2 Binary Numbers 1.3 Number-Base Conversions 1.4 Octal a n d h exad e cimal Numbers."

Similar presentations


Ads by Google