Number System (PDF)

Pages to are hidden for

"Number System (PDF)"

Please download to view full document

```					  EEB 2023
Microprocessor

Number Systems
A Review

Antonakos, Appendix F, pp.605
Microprocessor

1
Jump to first page
Objectives
I   Examine the decimal number systems
N Decimal to binary
N Binary to decimal
I   Examine the hexadecimal number system
N Binary to hexadecimal
N Hexadecimal to binary
I   Examine the octal number system
I   Floating point numbers
Microprocessor

2
Jump to first page
Outcomes
I   To explain the necessity of decimal, binary,
hexadecimal number systems
I   To be able to convert decimal numbers to binary
numbers and vice versa
I   To be able to convert binary numbers to
hexadecimal numbers and vice versa
I   To be able to convert binary numbers to octal
numbers and vice versa

Microprocessor

3
Jump to first page
Counting in Decimal
0      1          2    3    4    5    6    7    8       9
10     11         12   13   14   15   16   17   18      19
20     21         22   23   24   25   26   27   28      29
30     31         32   33   34   35   36   37   38      39
40     41         42
50

Microprocessor

4
Jump to first page
Counting in Binary

0   0   0
0   0   1
0   1   0
0   1   1
1   0   0

Microprocessor

5
Jump to first page
Converting Binary to Decimal
I Example: Convert 11001010 to decimal
Step 1 Write down the binary weightings

Step 2 Put binary number into weightings table

Step 3 Add the bits which have a 1.
128 + 64 + 8 + 2 = 202
Microprocessor

6
Jump to first page
Converting Decimal to Binary
I Example: Convert 231 to binary
Step 1 Write out the weightings of eight number

Step 2 Subtract each weighting in turn from the
given number, starting with the largest
weighting
I If subtraction leads to a +ve result record a 1

I If subtraction leads to a -ve result record a 0

Microprocessor

7
Jump to first page
231                       7
-128       1*          -   4   1
-    103               -       3
- 64       1           -   2   1
39                       1
- 32       1           -   1   1
7                       0
- 16       0       The binary number can be read off
7               from top to bottom:
- 8        0                            11100111
Microprocessor

8
Jump to first page
Another example
143                         7
-128            1*       -   4   1
-     15                 -       3
- 64            0        -   2   1
15                         1
- 32            0        -   1   1
15                         0
- 16            0
15                 The binary number can be read off
- 8             1    from top to bottom:
10001111
Microprocessor

9
Jump to first page
Exercise
I   Convert 11111000 to decimal.
I   Convert 12010 to binary
ANS:
I 248

I 1111000

Microprocessor

10
Jump to first page
Two’s Complement
Step 1: Invert all bits (1’s complement)

Step 2: Add 1 to the complemented number

Example: Obtain the 2’s complement of -21

+21 = 0 0 0 1 0 1 0 1
11101010          invert (1’s complement)
1   add 1
-21 = 1 1 1 0 1 0 1 1

Microprocessor

11
Jump to first page
Adding Signed Numbers
Example: Add decimal numbers +6 and -4

Step 1: Obtain 2’s complement of -4
+4 = 0 0 0 0 0 1 0 0
11111011         1’s complement
1    add 1
-4= 11111100

Step 2: +6 - 4 =    00000110
11111100 +
100000010
Microprocessor

12
Jump to first page
Exercise
I    Add +9-4 using 2’s complement.

Step 1: Obtain 2’s complement of -4
+4 = 0 0 0 0 0 1 0 0
11111011         1’s complement
1    add 1
-4= 11111100

Step 2: +9 - 4 =      00001001
11111100 +
100000101
Microprocessor

13
Jump to first page
101010101111000011111110001000010000010101010101011111100011101011
010101010101111111110001010001011111110001010101010000101010011011
101010101010101010101010101010101010101010010000001100101010101010
101010101001011011111000101100011000010001000001111100101001010101
010101111000110010000111101010101010100101010101010101010010101010
000010101010101110011111111111111110000000000000010101010101010010
101010010101000000101011011001101110001100010001110011101111110001
010010101010101010101001010101001001010101010101010101001010101001
010100101010101010010101001010100100001010101010101010010000001111
011101010101010100101000111110000010101010010010010101010100101010
000010101011111001010101010101010010101111110001010101110001100101
001011110011111001110111110000000110000010010100100100000111000100
101010100101010101010010101010101000101001110100101001001000101010
100101010010101010010101010100101010101010010000000111111111111111
010000000000101010100101010100101010010101010101010101010101000010
111010010101001001010101010101010101010101010101010101010101010101
001011011111000101100011000010001000001111100101001010101010101111
000110010000111101010101010100101010101010101010010101010000010101
010101110011111111111111110000000000000010101010101010010101010010
101000000101011011001101110001100010001110011100101010101010101010
100101101111100010110001100001000100000111110010100101010101010111
Microprocessor

14
Jump to first page
Hexadecimal Number System
I   Base 16
I   Symbols used are: 0 - 9, A - F
N   0123456789ABCDEF
I   For an 8-bit binary number, the 8 bits are
divided in to two groups of 4 bits.
N   Each group of 4 bits can be represented by a
hex symbol.

Microprocessor

15
Jump to first page
Decimal   Hex   Binary
0         0     0000
1         1     0001
2         2     0010
3         3     0011
4         4     0100
5         5     0101
6         6     0110
7         7     0111
8         8     1000
9         9     1001
10        A     1010
11        B     1011
12        C     1100
13        D     1101
14        E     1110
15        F     1111

Microprocessor

16
Jump to first page
Example 1: Convert 01001110 to hexadecimal
0100 1110
4      E

Example 2: Convert hex B804 to its binary equivalent

B    8   0     4
1011 1000 0000 0100

Microprocessor

17
Jump to first page
Counting in Hexadecimal
0 1 2 3 4 5 6 7 8 9 A B C                 D E F
10 11 12 13 14 15 16 17 18 19 1A 1B 1C    1D 1E 1F
20 21 22 23 24                2A 2B 2C          2F

90                                           9F
A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
F0 F1                                        FF

Microprocessor

18
Jump to first page
Exercise
I   Convert 3D16 to binary
I   Convert 01010101 to hexadecimal
ANS:
I 00111101

I 5516

Microprocessor

19
Jump to first page
Octal Number System
I    Base 8 system
I    Symbols used are 0 - 7
N   01234567
I    Three binary bits are used to represent one
octal symbol

Microprocessor

20
Jump to first page
Octal to Binary
A sequence of 8 bits can be represented as follows;
Example: Convert an 8-bit binary number to its octal
equivalent
01001110

01 001   110      binary
1  1     6       octal

Microprocessor

21
Jump to first page
SAQ
I   Find as many interpretations as possible for the
binary word
10110111

I   Unsigned integer: 18310
I   2complements signed integer: -7310
I   Floating point fraction: depends on how many of
the eight bits are used for the mantissa and how
many for the exponent.

Microprocessor

22
Jump to first page

```
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
 views: 24 posted: 4/14/2012 language: English pages: 22
Description: This article will explain and review some coversion in number system. From decimal to binary, from binary to decimal, from dinary to hecadecimal, from hexadecimal to binary. Then examine the octal number system and floating point numbers.