Presentation is loading. Please wait.

Presentation is loading. Please wait.

Binary Addition (1 of 2) Two 1-bit values A B A + B 1

Similar presentations


Presentation on theme: "Binary Addition (1 of 2) Two 1-bit values A B A + B 1"— Presentation transcript:

1 Binary Addition (1 of 2) Two 1-bit values A B A + B 1
1 1 Carry one to next

2

3 Binary Subtraction

4

5

6 d

7 Example2

8

9 Subtraction using 2’s complements
How to find 2’s Complement Step1: Find 1’s complement Step2: ADD 1 to find 2’s complements

10

11

12 d 256 128 64 32 16 8 4 2 1 54 22

13

14

15 y

16 Example 2nd ks 2 complement + 1 Find 2’s Complements of Ans If No carry remaining

17 Example – Ans: 2nd ks 2 complement + 1 + 1 Find 2’s Complements of Ans If No carry remaining

18 11001 256 128 64 32 16 8 4 2 1 =25

19 Binary numbers? Computers work only on two states
Off Basic memory elements hold only two states Zero / One Thus a number system with two elements {0,1} A binary digit – bit !

20 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

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

22 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

23 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.

24 Decimal to Binary Decimal to Octal Decimal to Hexadecimal

25 Decimal to Binary Decimal to Octal Decimal to Hexadecimal

26 Decimal to Binary Examples: 7.7510 = (?)2 7 / 2 = 3 (Q), 1 (R) 
710 = 1112 0.75 x 2 =1.50  extract 1 0.5 x 2 =  extract = 0.112  stop Ans

27 Exercise Exercise 1: Convert (0.625)10 to its binary form
Solution: Solution: x 2 = 1.25  extract 1 0.25 x 2 = 0.5  extract 0 0.5 x 2 = 1.0  extract 1 0.0  stop  (0.625)10 = (0.101)2 0.6 x 2 = 1.2  extract 1 0.2 x 2 = 0.4  extract 0 0.4 x 2 = 0.8  extract 0 0.8 x 2 = 1.6  extract 1 0.6 x 2 =   (0.6)10 = ( …)2

28 Exercise Examples: try 5.625B
Exercise 3: Convert (0.8125)10 to its binary form Solution: x 2 =  extract 1 0.625 x 2 = 1.25  extract 1 0.25 x 2 = 0.5  extract 0 0.5 x 2 = 1.0  extract 1 0.0  stop  (0.8125)10 = (0.1101)2 Examples: try 5.625B

29 Fractions Decimal to binary
x x x x x x etc. p. 50

30 Binary to Decimal Octal to Decimal Hexadecimal to Decimal

31 Binary Decimal 1101 = 1 x 23 + 1 x 22 + 0 x 21 + 1 x 20
= (1101)2 = (13)10 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, ….

32 Decimal Binary 2 13 LSB 1 2 6 2 3 1 2 1 1 MSB (13)10 = (1101)2

33 Octal Decimal 137 = 1 x 82 + 3 x 81 + 7 x 80 = 1 x 64 + 3 x 8 + 7 x 1
= (137)8 = (95)10 Digits used in Octal number system – 0 to 7

34 Decimal Octal 8 95 LSP 7 8 11 3 8 1 1 MSP (95)10 = (137)8

35 Hex Decimal A = 10, B = 11, C = 12, D = 13, E = 14, F = 15
BAD = 11 x x x 160 = 11 x x x 1 = (BAD)16 = (2989)10 A = 10, B = 11, C = 12, D = 13, E = 14, F = 15

36 Decimal Hex 16 2989 LSP 13 16 186 10 16 11 11 MSP (2989)10 = (BAD)16

37 Binary to Decimal Octal to Decimal 1010112 =>
7248 => 4 x 80 = x 81 = x 82 = 448 Ans: 46810 => 1 x 20 = 1 1 x 21 = 2 0 x 22 = 0 1 x 23 = 8 0 x 24 = 0 1 x 25 =32 Ans. 4310 Hexadecimal to Decimal ABC16 => C x 160 = 12 x 1 = 12 B x 161 = 11 x 16 = 176 A x 162 = 10 x 256 = 2560 274810

38 Fractions Binary to decimal 10.1011 =>
1 x 2-4 = x 2-3 = x 2-2 = x 2-1 = x 20 = x 21 =

39 Binary to Hexadecimal

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

41 d

42 d


Download ppt "Binary Addition (1 of 2) Two 1-bit values A B A + B 1"

Similar presentations


Ads by Google