chapter 1 number systems and codes 1. objectives you should be able to: –explain the difference...

30
Chapter 1 Chapter 1 Number Systems and Codes Number Systems and Codes 1

Upload: sonya-huffington

Post on 14-Dec-2015

215 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Chapter 1 Number Systems and Codes 1. Objectives  You should be able to: –Explain the difference between analog and digital. –Determine the weighting

Chapter 1Chapter 1

Number Systems and CodesNumber Systems and Codes

1

Page 2: Chapter 1 Number Systems and Codes 1. Objectives  You should be able to: –Explain the difference between analog and digital. –Determine the weighting

ObjectivesObjectives

You should be able to:You should be able to:– Explain the difference between analog and Explain the difference between analog and

digital.digital.

– Determine the weighting of digit positions in Determine the weighting of digit positions in decimal, binary, octal, and hexadecimal decimal, binary, octal, and hexadecimal numbering systems.numbering systems.

– Convert numbers among the four numbering Convert numbers among the four numbering systems.systems.

2

Page 3: Chapter 1 Number Systems and Codes 1. Objectives  You should be able to: –Explain the difference between analog and digital. –Determine the weighting

ObjectivesObjectives

You should be able to:You should be able to:– Describe binary coded decimal (BCD) Describe binary coded decimal (BCD)

numbers.numbers.

– Translate alphanumeric data to and from Translate alphanumeric data to and from ASCII.ASCII.

3

Page 4: Chapter 1 Number Systems and Codes 1. Objectives  You should be able to: –Explain the difference between analog and digital. –Determine the weighting

Digital versus AnalogDigital versus Analog

DigitalDigital– ON and OFFON and OFF

– 0 and 10 and 1

AnalogAnalog– Continuously varyingContinuously varying

– Examples: temperature, pressure, velocityExamples: temperature, pressure, velocity

See Figure 1-1See Figure 1-1

4

Page 5: Chapter 1 Number Systems and Codes 1. Objectives  You should be able to: –Explain the difference between analog and digital. –Determine the weighting

Figure 1-1

5

Page 6: Chapter 1 Number Systems and Codes 1. Objectives  You should be able to: –Explain the difference between analog and digital. –Determine the weighting

Discussion PointsDiscussion Points

Explain the difference between analog and Explain the difference between analog and digital signals.digital signals.

Describe some applications for digital Describe some applications for digital technology.technology.

What are the benefits of using digital What are the benefits of using digital systems?systems?

Are there any problems associated with Are there any problems associated with digital systems?digital systems?

6

Page 7: Chapter 1 Number Systems and Codes 1. Objectives  You should be able to: –Explain the difference between analog and digital. –Determine the weighting

Digital Representations of Digital Representations of Analog QuantitiesAnalog Quantities

Audio RecordingAudio Recording– CD, DAT, and MP3CD, DAT, and MP3

ConversionsConversions– Digital-to-analogDigital-to-analog

– Analog voltage to 8-bit Digital equivalentAnalog voltage to 8-bit Digital equivalent

See Figures 1-2 and 1-3See Figures 1-2 and 1-3

7

Page 8: Chapter 1 Number Systems and Codes 1. Objectives  You should be able to: –Explain the difference between analog and digital. –Determine the weighting

Figure 1-2

Figure 1-3

8

Page 9: Chapter 1 Number Systems and Codes 1. Objectives  You should be able to: –Explain the difference between analog and digital. –Determine the weighting

Why Digital systems are immune to analog noise

9

Page 10: Chapter 1 Number Systems and Codes 1. Objectives  You should be able to: –Explain the difference between analog and digital. –Determine the weighting

Decimal Numbering System Decimal Numbering System (Base 10)(Base 10)

10 different possible digits10 different possible digits Least significant positionLeast significant position

– RightmostRightmost

MostMost significant digitsignificant digit– LeftmostLeftmost

Weighting factor of 10Weighting factor of 10

10

Page 11: Chapter 1 Number Systems and Codes 1. Objectives  You should be able to: –Explain the difference between analog and digital. –Determine the weighting

Binary Numbering SystemBinary Numbering System (Base 2) (Base 2)

Only 0 and 1Only 0 and 1 Weighting factor of 2Weighting factor of 2 Conversion techniquesConversion techniques

– Digit times weighting factorDigit times weighting factor

– Successive divisionSuccessive division

11

Page 12: Chapter 1 Number Systems and Codes 1. Objectives  You should be able to: –Explain the difference between analog and digital. –Determine the weighting

Decimal-to-Binary ConversionDecimal-to-Binary Conversion

Subtracting weighting factorsSubtracting weighting factors Successive divisionSuccessive division Least Significant Bit (LSB)Least Significant Bit (LSB) Most Significant Bit (MSB)Most Significant Bit (MSB)

12

Page 13: Chapter 1 Number Systems and Codes 1. Objectives  You should be able to: –Explain the difference between analog and digital. –Determine the weighting

Octal Numbering SystemOctal Numbering System(Base 8)(Base 8)

Allowable digitsAllowable digits– 0,1,2,3,4,5,6,70,1,2,3,4,5,6,7

Weighting factor of 8Weighting factor of 8

13

Page 14: Chapter 1 Number Systems and Codes 1. Objectives  You should be able to: –Explain the difference between analog and digital. –Determine the weighting

Octal ConversionsOctal Conversions

Binary to octalBinary to octal– Group binary positions in groups of threeGroup binary positions in groups of three– Write the octal equivalentWrite the octal equivalent

Octal to binaryOctal to binary– Reverse the processReverse the process

Octal to decimalOctal to decimal– Multiply by weighting factorsMultiply by weighting factors

Decimal to octalDecimal to octal– Successive divisionSuccessive division

14

Page 15: Chapter 1 Number Systems and Codes 1. Objectives  You should be able to: –Explain the difference between analog and digital. –Determine the weighting

Hexadecimal Numbering SystemHexadecimal Numbering System(Base 16)(Base 16)

4-bit groupings4-bit groupings See Table 1-3 in your textSee Table 1-3 in your text Two hex digits are used to represent 8 bitsTwo hex digits are used to represent 8 bits

– A byteA byte

– 4 bits are a nibble4 bits are a nibble

15

Page 16: Chapter 1 Number Systems and Codes 1. Objectives  You should be able to: –Explain the difference between analog and digital. –Determine the weighting

Hexadecimal ConversionsHexadecimal Conversions

Binary to hexadecimalBinary to hexadecimal– Group the binary in groups of fourGroup the binary in groups of four

– Write the equivalent hex digitWrite the equivalent hex digit

Hexadecimal to binaryHexadecimal to binary– Reverse the processReverse the process

16

Page 17: Chapter 1 Number Systems and Codes 1. Objectives  You should be able to: –Explain the difference between analog and digital. –Determine the weighting

Hexadecimal ConversionsHexadecimal Conversions

Hexadecimal to decimalHexadecimal to decimal– Multiply by weighting factorsMultiply by weighting factors

Decimal to hexadecimalDecimal to hexadecimal– Successive divisionSuccessive division

17

Page 18: Chapter 1 Number Systems and Codes 1. Objectives  You should be able to: –Explain the difference between analog and digital. –Determine the weighting

Binary-Coded-Decimal SystemBinary-Coded-Decimal SystemBCDBCD

Each of the 10 decimal digits has a 4-bit Each of the 10 decimal digits has a 4-bit binary codebinary code

ConversionConversion– Convert each decimal digit to its 4-bit binary Convert each decimal digit to its 4-bit binary

codecode

– BCD to decimal - reverse the processBCD to decimal - reverse the process

18

Page 19: Chapter 1 Number Systems and Codes 1. Objectives  You should be able to: –Explain the difference between analog and digital. –Determine the weighting

Comparison of Numbering Comparison of Numbering SystemsSystems

See Table 1-4 in your textSee Table 1-4 in your text

19

Page 20: Chapter 1 Number Systems and Codes 1. Objectives  You should be able to: –Explain the difference between analog and digital. –Determine the weighting

The ASCII CodeThe ASCII Code

Represents alphanumeric dataRepresents alphanumeric data Uses 7 bitsUses 7 bits 128 different code combinations128 different code combinations See Table 1-5See Table 1-5

– 3-bit group is most significant3-bit group is most significant

– 4-bit group is least significant4-bit group is least significant

20

Page 21: Chapter 1 Number Systems and Codes 1. Objectives  You should be able to: –Explain the difference between analog and digital. –Determine the weighting

21

Page 22: Chapter 1 Number Systems and Codes 1. Objectives  You should be able to: –Explain the difference between analog and digital. –Determine the weighting

Applications of the Numbering Applications of the Numbering SystemsSystems

Application 1-1Application 1-1

22

Page 23: Chapter 1 Number Systems and Codes 1. Objectives  You should be able to: –Explain the difference between analog and digital. –Determine the weighting

Applications of the Applications of the Numbering SystemsNumbering Systems

Application 1-2Application 1-2–A CD player is capable of converting A CD player is capable of converting

12 bit signals from a CD into 12 bit signals from a CD into equivalent analog values.equivalent analog values.What are the largest and smallest hex What are the largest and smallest hex

values that can be used in this values that can be used in this system?system?

How many different analog values can How many different analog values can be represented?be represented?

23

Page 24: Chapter 1 Number Systems and Codes 1. Objectives  You should be able to: –Explain the difference between analog and digital. –Determine the weighting

Applications of the Applications of the Numbering SystemsNumbering Systems

Application 1-3Application 1-3–Typically, digital thermometers Typically, digital thermometers

use BCD to drive their displays.use BCD to drive their displays.How many BCD bits are required to How many BCD bits are required to

drive a 3 digit thermometer display?drive a 3 digit thermometer display?What bits are sent to the display for What bits are sent to the display for

147 degrees? 147 degrees?

24

Page 25: Chapter 1 Number Systems and Codes 1. Objectives  You should be able to: –Explain the difference between analog and digital. –Determine the weighting

Applications of the Numbering Applications of the Numbering SystemsSystems

Application 1-4Application 1-4– Most PC-compatible computer systems use a Most PC-compatible computer systems use a

20-bit address code to identify each of over 1 20-bit address code to identify each of over 1 million memory locations.million memory locations. How many hex characters are required to identify How many hex characters are required to identify

the address of each memory location?the address of each memory location? What is the hex address of the 200What is the hex address of the 200 thth memory memory

location?location? If 50 memory locations are used for data storage If 50 memory locations are used for data storage

starting at location 000C8H, what is the location starting at location 000C8H, what is the location of the last data item?of the last data item?

25

Page 26: Chapter 1 Number Systems and Codes 1. Objectives  You should be able to: –Explain the difference between analog and digital. –Determine the weighting

Applications of the Numbering Applications of the Numbering SystemsSystems

Application 1-5Application 1-5–If the part number 651-M is If the part number 651-M is

stored in ASCII in a computer stored in ASCII in a computer memory, list the binary contents memory, list the binary contents of its memory locations.of its memory locations.

26

Page 27: Chapter 1 Number Systems and Codes 1. Objectives  You should be able to: –Explain the difference between analog and digital. –Determine the weighting

Applications of the Numbering Applications of the Numbering SystemsSystems

Application 1-6Application 1-6– A programmer uses a debugging utility to A programmer uses a debugging utility to

find an error in a BASIC program. The find an error in a BASIC program. The utility shows the ASCII code as hex utility shows the ASCII code as hex 474F5430203930. Assume that the 474F5430203930. Assume that the leftmost bit of each ASCII string is leftmost bit of each ASCII string is padded with a zero.padded with a zero. Translate the program segment that is Translate the program segment that is

displayed.displayed. Try to determine what the error is.Try to determine what the error is.

27

Page 28: Chapter 1 Number Systems and Codes 1. Objectives  You should be able to: –Explain the difference between analog and digital. –Determine the weighting

SummarySummary

Numerical quantities occur in analog form Numerical quantities occur in analog form but must be converted to digital form to be but must be converted to digital form to be used by computers or digital circuitry.used by computers or digital circuitry.

The binary numbering system is used in The binary numbering system is used in digital systems because the 1’s and 0’s are digital systems because the 1’s and 0’s are easily represented by ON or OFF easily represented by ON or OFF transistors, which output 0V for 0 and 5V for transistors, which output 0V for 0 and 5V for 1.1.

28

Page 29: Chapter 1 Number Systems and Codes 1. Objectives  You should be able to: –Explain the difference between analog and digital. –Determine the weighting

SummarySummary

Any number system can be converted to Any number system can be converted to decimal by multiplying each digit by its decimal by multiplying each digit by its weighting factor.weighting factor.

The weighting factor for the least significant The weighting factor for the least significant digit in any number system is always 1.digit in any number system is always 1.

Binary numbers can be converted to octal Binary numbers can be converted to octal by forming groups of 3 bits and to by forming groups of 3 bits and to hexadecimal by forming groups of 4 bits.hexadecimal by forming groups of 4 bits.

29

Page 30: Chapter 1 Number Systems and Codes 1. Objectives  You should be able to: –Explain the difference between analog and digital. –Determine the weighting

SummarySummary

The successive division procedure can be The successive division procedure can be used to convert from decimal to binary, used to convert from decimal to binary, octal or hexadecimaloctal or hexadecimal

The binary-coded-decimal system uses The binary-coded-decimal system uses groups of 4 bits to drive decimal displays groups of 4 bits to drive decimal displays such as those in a calculator.such as those in a calculator.

ASCII is used by computers to represent all ASCII is used by computers to represent all letters, numbers and symbols in digital letters, numbers and symbols in digital form.form.

30