copyright (c) 2004 professor keith w. noe number systems & codes part i

51
Copyright (c) 2004 Professor Kei th W. Noe Number Systems & Codes Part I

Post on 19-Dec-2015

221 views

Category:

Documents


4 download

TRANSCRIPT

Copyright (c) 2004 Professor Keith W. Noe

Number Systems & Codes

Part I

Copyright (c) 2004 Professor Keith W. Noe

Reading Assignment

Digital Design with CPLD Applications and VHDL, by Robert K. Dueck

Chapter 1, Pages 6 through 17

Copyright (c) 2004 Professor Keith W. Noe

Objectives

• Explain positional notation and write the positional multipliers for any number base.

• Count in binary, octal, decimal, & hexadecimal.

• Write a given number in any base using positional notation.

Upon the successful completion of this lesson, you should be able to:

Copyright (c) 2004 Professor Keith W. Noe

Objectives

• Convert a binary, octal & hexadecimal number to decimal.

Upon the successful completion of this lesson, you should be able to:

Copyright (c) 2004 Professor Keith W. Noe

Number System Basics

• The base of the number system identifies how many unique symbols are used for that particular number system.

• The base of the number system identifies the value of the highest symbol.

• All number systems begin counting at Zero.

All number systems have some commonalities:

Copyright (c) 2004 Professor Keith W. Noe

The Decimal Number System

• Has ten unique symbols.• The ten symbols are: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 • The value for the highest symbol is

determined using the following formula: Highest Symbol Value = Base – 1

• (Base) 10 – 1 = 9• The value for the highest symbol in the

decimal number system is 9.

Copyright (c) 2004 Professor Keith W. Noe

The Decimal Number System

• When you begin counting in a number system, always begin with Zero.

• When you have used up all of the symbols, increment the column to the left by 1 and begin counting again starting with Zero.

Counting in decimal or Base 10 number system

Copyright (c) 2004 Professor Keith W. Noe

The Decimal Number System

Counting in the decimal or Base 10 number system.

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

Copyright (c) 2004 Professor Keith W. Noe

The Decimal Number System

• All number systems use positional notation.• The base of the number identifies the base

value to be used when determining the value for each position.

• All number systems use a POINT to separate the integer from the factional part.

• For Base 10, this is called the decimal point.

Positional Notation

Copyright (c) 2004 Professor Keith W. Noe

The Decimal Number System

• The values of the positional multipliers are the number system’s base raised to a power.

• For the decimal number system, the multipliers are the powers of ten:

104 103 102 101 100 . 10-1 10-2

10,000 1,000 100 10 1 . 0.1 0.01

Copyright (c) 2004 Professor Keith W. Noe

The Decimal Number System

Positional Notation

For example: 37,42810

3 x 104 = 3 x 10,000 = 30,000

7 x 103 = 7 x 1, 000 = 7,000

4 x 102 = 4 x 100 = 400

2 x 101 = 2 x 10 = 20

8 x 100 = 8 x 1 = 8

Copyright (c) 2004 Professor Keith W. Noe

The Decimal Number System

Express this base 10 number in positional notation:

56,782.45

Copyright (c) 2004 Professor Keith W. Noe

The Decimal Number System

Solution

5 x 104 = 5 x 10,000 = 50,000

6 x 103 = 6 x 1,000 = 6,000

7 x 102 = 7 x 100 = 700

8 x 101 = 8 x 10 = 80

2 x 100 = 2 x 1 = 2

4 x 10-1 = 4 x 0.1 = 0.4

+ 5 x 10-2 = 5 x 0.01 = 0.05

56,782.45

Copyright (c) 2004 Professor Keith W. Noe

Other Number Systems Used in Digital Electronics & Computers

• Binary (Base 2)

• Octal (Base 8)

• Hexadecimal (Base 16)

Copyright (c) 2004 Professor Keith W. Noe

Summary About the Basics

All of the basics discussed as they relate to the decimal number system applies directly to the Binary, Octal & Hexadecimal number systems.

Copyright (c) 2004 Professor Keith W. Noe

The Binary Number System

Base 2

Copyright (c) 2004 Professor Keith W. Noe

The Binary Number System

• Has two unique symbols.• Remember, the value of the highest symbol

equals the Base of the Number System minus 1.

• Base 2 – 1 = 1• Therefore, the highest symbol in the binary

number system is 1.

Copyright (c) 2004 Professor Keith W. Noe

The Binary Number System

• When counting in binary, begin with Zero, just as you do with any other number system.

• When you have used all of the unique symbols, increment the column to the left by one and start with Zero again.

Counting in Binary

Copyright (c) 2004 Professor Keith W. Noe

The Binary Number System

Counting in Binary

0

1

10

11

100

101

110

111

Copyright (c) 2004 Professor Keith W. Noe

The Binary Number System

Counting in Binary

Write the next 16 counts beginning with 100002

Copyright (c) 2004 Professor Keith W. Noe

The Binary Number System

You should have written -

10001 10101 11001 11101

10010 10110 11010 11110

10011 10111 11011 11111

10100 11000 11100 100000

Copyright (c) 2004 Professor Keith W. Noe

The Binary Number System

• Each position will be 2 raised to a power.• The binary number system is based on the powers

of 2.

25, 24, 23, 22, 21, 20 . 2-1, 2-2, 2-3, etc.• The point that separates the integer part from the

fractional part of the number is called the binary point.

Positional Notation

Copyright (c) 2004 Professor Keith W. Noe

The Binary Number System

• Positional notation in the binary number system is based on powers of two.

• For example:

25, 24, 23, 22, 21, 20 . 2-1, 2-2, etc.

32 16 8 4 2 1 .5 .25

Positional Notation

Copyright (c) 2004 Professor Keith W. Noe

The Binary Number System

Positional NotationFor example: 110112

1 x 24 = 1 x 16 = 16

1 x 23 = 1 x 8 = 8

0 x 22 = 0 x 4 = 0

1 x 21 = 1 x 2 = 2

+ 1 x 20 = 1 x 1 = 1

27

Copyright (c) 2004 Professor Keith W. Noe

The Binary Number System

Express this binary number in positional notation:

101101.012

Copyright (c) 2004 Professor Keith W. Noe

The Binary Number System

1 x 25 = 1 x 32 = 32.00

0 x 24 = 1 x 16 = 0.00

1 x 23 = 1 x 8 = 8.00

1 x 22 = 1 x 4 = 4.00

0 x 21 = 0 x 2 = 0.00

1 x 20 = 1 x 1 = 1.00

0 x 2-1 = 0 x 0.5 = 0.00

+ 1 x 2-2 = 0 x .25 = 0.25

45.25

S

O

L

U

T

I

O

N

Copyright (c) 2004 Professor Keith W. Noe

The Octal Number System

Base 8

Copyright (c) 2004 Professor Keith W. Noe

The Octal Number System

• Is based on powers of 8.

• The value of the highest symbol is 7.

• The octal point separates the integer portion of the number from the fractional portion of the number.

Copyright (c) 2004 Professor Keith W. Noe

The Octal Number System

• When counting in the octal number system, begin with Zero.

• When you have used all of the unique symbols, increment the column to the left by one and begin with zero again.

Counting in Base 8

Copyright (c) 2004 Professor Keith W. Noe

The Octal Number System

Counting in Base 8

0 1 2 3 4 5 6 7

10 11 12 13 14 15 16 17

20 21 22 23 24 25 26 27

30 31 32 33 34 35 36 37

Copyright (c) 2004 Professor Keith W. Noe

The Octal Number System

Counting in Base 8

Write the next 23 counts beginning with:

608

Copyright (c) 2004 Professor Keith W. Noe

The Octal Number System

Counting in Base 8

You should have written:

60 61 62 63 64 65 66 67

70 71 72 73 74 75 76 77

100 101 102 103 104 105 106 107

Copyright (c) 2004 Professor Keith W. Noe

The Octal Number System

• The positional multipliers for the octal number system are:

84 83 82 81 80 . 8-1 8-2

4096 512 64 8 1 . 0.125 0.015625

Positional Notation

Copyright (c) 2004 Professor Keith W. Noe

The Octal Number System

Positional Notation

For Example: 74628

7 x 83 = 7 x 512 = 3,584

4 x 82 = 4 x 64 = 256

6 x 81 = 6 x 8 = 48

+ 2 x 80 = 2 x 1 = 2

3,890

Copyright (c) 2004 Professor Keith W. Noe

The Octal Number System

Express this octal number using positional notation:

4712.58

Copyright (c) 2004 Professor Keith W. Noe

The Octal Number System

4 x 83 = 4 x 512 = 2,048.000

7 x 82 = 7 x 64 = 448.000

1 x 81 = 1 x 8 = 8.000

2 x 80 = 2 x 1 = 2.000

+ 5 x 8-1 = 5 x 0.125 = 0.625

2,506.625

Copyright (c) 2004 Professor Keith W. Noe

The Hexadecimal Number System

Base 16

Copyright (c) 2004 Professor Keith W. Noe

The Hexadecimal Number System

• The base of this number system is 16.

• There are 16 unique symbols for this number system.

• The sixteen symbols are:

0 1 2 3 4 5 6 7 8 9 A B C D E F

Copyright (c) 2004 Professor Keith W. Noe

The Hexadecimal Number System

• A numeric symbol must occupy only one place in a number.

• Numbers such as 12, 15, 24, etc uses two symbols as two places are occupied.

• Since there are only 10 symbols defined because of the decimal number system, six additional symbols must be selected.

Some Additional Information

Copyright (c) 2004 Professor Keith W. Noe

The Hexadecimal Number System

• The six extra symbols needed are borrowed from the alphabet.

• The six letters borrowed from the alphabet are: A B C D E F

Some Additional Information

Copyright (c) 2004 Professor Keith W. Noe

The Hexadecimal Number System

• This number system begins counting at zero.

• After counting from 0 to 9, the next six counts are A, B, C, D, E, F.

• After using the 16 possible symbols, increment the next column to the left by one and start counting with zero again.

Counting in Hexadecimal

Copyright (c) 2004 Professor Keith W. Noe

The Hexadecimal Number System

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 25 26 27 28 29 2A 2B 2C 2D 2E 2F

30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F

Copyright (c) 2004 Professor Keith W. Noe

The Hexadecimal Number System

Counting in Hexadecimal

Write the next 32 counts beginning with 4016

Copyright (c) 2004 Professor Keith W. Noe

The Hexadecimal Number System

40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F

50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F

You should have written:

Copyright (c) 2004 Professor Keith W. Noe

The Hexadecimal Number System

• The hexadecimal number system uses positional notation just like the other number systems studied so far.

• The hexadecimal number system is based on the number 16.

• The Hexadecimal Point separates the integer portion of the number from the fractional portion.

Copyright (c) 2004 Professor Keith W. Noe

The Hexadecimal Number System

• The powers of 16 used for the positional notation system for base 16 are:

163 162 161 160 . 16-1

4,096 256 16 1 . 0.0625

Copyright (c) 2004 Professor Keith W. Noe

The Hexadecimal Number System

• Usually technicians and engineers in the digital electronics field often refer to the hexadecimal number system simply as Hex.

Copyright (c) 2004 Professor Keith W. Noe

The Hexadecimal Number System

Positional Notation

Look at this example: B95F16

B x 163 = 11 x 4,096 = 45,056

9 x 162 = 9 x 256 = 2,304

5 x 161 = 5 x 16 = 80

+ F x 160 = 15 x 1 = 15

47,455

Copyright (c) 2004 Professor Keith W. Noe

The Hexadecimal Number System

Express this base 16 number in positional notation: 3C9F.B16

Copyright (c) 2004 Professor Keith W. Noe

The Hexadecimal Number System

3 x 163 = 3 x 4,096 = 12,288.0000

C x 162 = 12 x 256 = 3,072.0000

9 x 161 = 9 x 16 = 144.0000

F x 160 = 15 x 1 = 15.0000

B x 16-1 = 11 x 0.0625 = 0.6875

15,519.6875

Copyright (c) 2004 Professor Keith W. Noe