Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 1 Number Systems & Conversions

Similar presentations


Presentation on theme: "Chapter 1 Number Systems & Conversions"— Presentation transcript:

1 Chapter 1 Number Systems & Conversions
Location in course textbook Chapter. 1 CNET 315 Microprocessor & Assembly Language

2 CNET 315 Microprocessor & Assembly Language
Common Number Systems Number 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 CNET 315 Microprocessor & Assembly Language

3 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 CNET 315 Microprocessor & Assembly Language

4 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 CNET 315 Microprocessor & Assembly Language

5 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. CNET 315 Microprocessor & Assembly Language

6 Conversion Among Bases
The possibilities: Decimal Octal Binary Hexadecimal CNET 315 Microprocessor & Assembly Language

7 CNET 315 Microprocessor & Assembly Language
Quick Example 2510 = = 318 = 1916 Base CNET 315 Microprocessor & Assembly Language

8 CNET 315 Microprocessor & Assembly Language
Weight 12510 => 5 x 100 = x 101 = x 102 = Base CNET 315 Microprocessor & Assembly Language

9 CNET 315 Microprocessor & Assembly Language
Binary to Decimal Decimal Octal Binary Hexadecimal CNET 315 Microprocessor & Assembly Language

10 CNET 315 Microprocessor & Assembly Language
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 CNET 315 Microprocessor & Assembly Language

11 CNET 315 Microprocessor & Assembly Language
Example Bit “0” => 1 x 20 = x 21 = x 22 = x 23 = x 24 = x 25 = 32 4310 CNET 315 Microprocessor & Assembly Language

12 CNET 315 Microprocessor & Assembly Language
Octal to Decimal Decimal Octal Binary Hexadecimal CNET 315 Microprocessor & Assembly Language

13 CNET 315 Microprocessor & Assembly Language
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 CNET 315 Microprocessor & Assembly Language

14 CNET 315 Microprocessor & Assembly Language
Example 7248 => 4 x 80 = x 81 = x 82 = CNET 315 Microprocessor & Assembly Language

15 Hexadecimal to Decimal
Octal Binary Hexadecimal CNET 315 Microprocessor & Assembly Language

16 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 CNET 315 Microprocessor & Assembly Language

17 CNET 315 Microprocessor & Assembly Language
Example ABC16 => C x 160 = 12 x 1 = B x 161 = 11 x 16 = A x 162 = 10 x 256 = 2560 274810 CNET 315 Microprocessor & Assembly Language

18 CNET 315 Microprocessor & Assembly Language
Decimal to Binary Decimal Octal Binary Hexadecimal CNET 315 Microprocessor & Assembly Language

19 CNET 315 Microprocessor & Assembly Language
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. CNET 315 Microprocessor & Assembly Language

20 CNET 315 Microprocessor & Assembly Language
Example 12510 = ?2 12510 = CNET 315 Microprocessor & Assembly Language

21 CNET 315 Microprocessor & Assembly Language
Octal to Binary Decimal Octal Binary Hexadecimal CNET 315 Microprocessor & Assembly Language

22 CNET 315 Microprocessor & Assembly Language
Octal to Binary Technique Convert each octal digit to a 3-bit equivalent binary representation CNET 315 Microprocessor & Assembly Language

23 CNET 315 Microprocessor & Assembly Language
Example 7058 = ?2 7058 = CNET 315 Microprocessor & Assembly Language

24 CNET 315 Microprocessor & Assembly Language
Hexadecimal to Binary Decimal Octal Binary Hexadecimal CNET 315 Microprocessor & Assembly Language

25 CNET 315 Microprocessor & Assembly Language
Hexadecimal to Binary Technique Convert each hexadecimal digit to a 4-bit equivalent binary representation CNET 315 Microprocessor & Assembly Language

26 CNET 315 Microprocessor & Assembly Language
Example 10AF16 = ?2 A F 10AF16 = CNET 315 Microprocessor & Assembly Language

27 CNET 315 Microprocessor & Assembly Language
Decimal to Octal Decimal Octal Binary Hexadecimal CNET 315 Microprocessor & Assembly Language

28 CNET 315 Microprocessor & Assembly Language
Decimal to Octal Technique Divide by 8 Keep track of the remainder CNET 315 Microprocessor & Assembly Language

29 CNET 315 Microprocessor & Assembly Language
Example = ?8 8 19 2 8 2 3 8 0 2 = 23228 CNET 315 Microprocessor & Assembly Language

30 Decimal to Hexadecimal
Octal Binary Hexadecimal CNET 315 Microprocessor & Assembly Language

31 Decimal to Hexadecimal
Technique Divide by 16 Keep track of the remainder CNET 315 Microprocessor & Assembly Language

32 CNET 315 Microprocessor & Assembly Language
Example = ?16 77 2 16 = D 0 4 = 4D216 CNET 315 Microprocessor & Assembly Language

33 CNET 315 Microprocessor & Assembly Language
Binary to Octal Decimal Octal Binary Hexadecimal CNET 315 Microprocessor & Assembly Language

34 CNET 315 Microprocessor & Assembly Language
Binary to Octal Technique Group bits in threes, starting on right Convert to octal digits CNET 315 Microprocessor & Assembly Language

35 CNET 315 Microprocessor & Assembly Language
Example = ?8 = 13278 CNET 315 Microprocessor & Assembly Language

36 CNET 315 Microprocessor & Assembly Language
Binary to Hexadecimal Decimal Octal Binary Hexadecimal CNET 315 Microprocessor & Assembly Language

37 CNET 315 Microprocessor & Assembly Language
Binary to Hexadecimal Technique Group bits in fours, starting on right Convert to hexadecimal digits CNET 315 Microprocessor & Assembly Language

38 CNET 315 Microprocessor & Assembly Language
Example = ?16 B B = 2BB16 CNET 315 Microprocessor & Assembly Language

39 CNET 315 Microprocessor & Assembly Language
Octal to Hexadecimal Decimal Octal Binary Hexadecimal CNET 315 Microprocessor & Assembly Language

40 CNET 315 Microprocessor & Assembly Language
Octal to Hexadecimal Technique Use binary as an intermediary CNET 315 Microprocessor & Assembly Language

41 CNET 315 Microprocessor & Assembly Language
Example 10768 = ?16 E 10768 = 23E16 CNET 315 Microprocessor & Assembly Language

42 CNET 315 Microprocessor & Assembly Language
Hexadecimal to Octal Decimal Octal Binary Hexadecimal CNET 315 Microprocessor & Assembly Language

43 CNET 315 Microprocessor & Assembly Language
Hexadecimal to Octal Technique Use binary as an intermediary CNET 315 Microprocessor & Assembly Language

44 CNET 315 Microprocessor & Assembly Language
Example 1F0C16 = ?8 1 F C 1F0C16 = CNET 315 Microprocessor & Assembly Language

45 CNET 315 Microprocessor & Assembly Language
Exercise – Convert ... Decimal Binary Octal Hexa- decimal 33 703 1AF Don’t use a calculator! CNET 315 Microprocessor & Assembly Language

46 CNET 315 Microprocessor & Assembly Language
Exercise – Convert … Answer Decimal Binary Octal Hexa- decimal 33 100001 41 21 117 165 75 451 703 1C3 431 657 1AF CNET 315 Microprocessor & Assembly Language

47 CNET 315 Microprocessor & Assembly Language
Binary Addition (1 of 2) Two 1-bit values A B A + B 1 10 “two” CNET 315 Microprocessor & Assembly Language

48 CNET 315 Microprocessor & Assembly Language
Binary Addition (2 of 2) Two n-bit values Add individual bits Propagate carries E.g., 1 1 CNET 315 Microprocessor & Assembly Language

49 Binary Subtraction Have previously looked at the subtraction operation. A quick review. Just like subtraction in any other base Minuend Subtrahand Difference And when a borrow is needed. Note that the borrow gives us 2 in the current bit position. .

50 CNET 315 Microprocessor & Assembly Language
Thank you CNET 315 Microprocessor & Assembly Language


Download ppt "Chapter 1 Number Systems & Conversions"

Similar presentations


Ads by Google