Digital Fundamentals

  • Uploaded by: badhell_18
  • 0
  • 0
  • May 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Digital Fundamentals as PDF for free.

More details

  • Words: 2,184
  • Pages: 55
Digital Fundamentals CHAPTER 1 (CONT…) Number Systems, Operations, and Codes

Slide 1

1. Number Systems 1.1 Decimal Numbers • The decimal number system has ten digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9 • The decimal numbering system has a base of 10 with each position weighted by a factor of 10:

Slide 2

1.2 Binary Numbers • The binary number system has two digits: 0 and 1 • The binary numbering system has a base of 2 with each position weighted by a factor of 2:

Slide 3

• Conversion 2.1 Binary to Decimal Conversion • Convert binary to decimal by summing the positions that contain a 1.

1

0

0 1 0 1

2

2 + 2 + 2 + 2 + 2 + 2 = 32 + 4 + 1 = 3710 5

4

3

2

1

Slide 4

0

2.2 Decimal to Binary Conversion •

Two methods to convert decimal to binary: – Reverse process described in 2.1 – Use repeated division

Slide 5

Decimal to Binary Conversion (cont…) •

Reverse process described in 2.1 – Note that all positions must be accounted for

3710 = 2 + 0 + 0 + 2 + 0 + 2 5

1

2

0

0

Slide 6

1

0

0

12

Decimal to Binary Conversion (cont…) • Repeated division steps: – Divide the decimal number by 2 – Write the remainder after each division until a quotient of zero is obtained. – The first remainder is the LSB and the last is the MSB • Note, when done on a calculator, a fractional answer indicates a remainder of 1.

Slide 7

Decimal to Binary Conversion (cont…) • Repeated division – This flowchart describes the process and can be used to convert from decimal to any other number system.

Slide 8

3. Hexadecimal Number System • Decimal, binary, and hexadecimal numbers

Slide 9

Hexadecimal Number System (cont….) • Most digital systems deal with groups of bits in even powers of 2 such as 8, 16, 32, and 64 bits. • Hexadecimal uses groups of 4 bits. • Base 16 – 16 possible symbols – 0-9 and A-F

Slide 10

Hexadecimal Number System (cont….) • Convert from hex to decimal by multiplying each hex digit by its positional weight. Example:

16316 = 1× (16 2 ) + 6 × (161 ) + 3 × (160 ) = 1× 256 + 6 ×16 + 3 ×1 = 35510 Slide 11

Hexadecimal Number System (cont….) • Convert from decimal to hex by using the repeated division method used for decimal to binary and decimal to octal conversion. • Divide the decimal number by 16 • The first remainder is the LSB and the last is the MSB. – Note, when done on a calculator a decimal remainder can be multiplied by 16 to get the result. If the remainder is greater than 9, the letters A through F are used. Slide 12

Hexadecimal Number System (cont….) Decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Hexadecimal 0 1 2 3 4 5 6 7 8 9 A B C D E F Binary 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

• Example of hex to binary conversion: 9F216 = 9 F

2

1001 1111

0010 = 1001111100102

Slide 13

Hexadecimal Number System (cont….) • Convert from binary to hex by grouping bits in four starting with the LSB. • Each group is then converted to the hex equivalent • Leading zeros can be added to the left of the MSB to fill out the last group. Slide 14

Hexadecimal Number System (cont….) Decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Hexadecimal 0 1 2 3 4 5 6 7 8 9 A B C D E F Binary 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111



Example of binary to hex conversion. (Note the addition of leading zeroes)

11101001102 = 0011 1010 0110 = 3 A 6 = 3A616 •

Counting in hex requires a reset and carry after reaching F. Slide 15

Hexadecimal Number System (cont….) • Hexadecimal is useful for representing long strings of bits. • Understanding the conversion process and memorizing the 4 bit patterns for each hexadecimal digit will prove valuable later.

Slide 16

4. Binary Coded Decimal (BCD) • Binary Coded Decimal (BCD) is another way to present decimal numbers in binary form. • BCD is widely used and combines features of both decimal and binary systems. • Each digit is converted to a binary equivalent. Slide 17

Binary Coded Decimal (cont…) Decimal and BCD digits

Slide 18

Binary Coded Decimal (cont…) • To convert the number 87410 to BCD: 8 7 4 0100 0111 0100 = 010001110100BCD • Each decimal digit is represented using 4 bits. • Each 4-bit group can never be greater than 9. • Reverse the process to convert BCD to decimal. Slide 19

Binary Coded Decimal (cont…) • BCD is not a number system. • BCD is a decimal number with each digit encoded to its binary equivalent. • A BCD number is not the same as a straight binary number. • The primary advantage of BCD is the relative ease of converting to and from decimal.

Slide 20

5.

Digital Codes

• Gray code:  The gray code is used in applications where numbers change rapidly.  In the gray code, only one bit changes from each value to the next.

Slide 21

Digital Codes (cont…) • ASCII – American Standard Code for Information Interchange. – Seven bit code: 27 = 128 possible code groups – Table 2-4 lists the standard ASCII codes – Examples of use are: to transfer information between computers, between computers and printers, and for internal storage.

Slide 22

Digital Codes (cont…) • ASCII code (control characters)

Slide 23

Digital Codes (cont…) • ASCII code (graphic symbols 20h – 3Fh)

Slide 24

Digital Codes (cont…) • ASCII code (graphic symbols 40h – 5Fh)

Slide 25

Digital Codes (cont…) • ASCII code (graphic symbols 60h – 7Fh)

Slide 26

Digital Codes (cont…) Extended ASCII code (80h – FFh) • Non-English alphabetic characters • Currency symbols • Greek letters • Math symbols • Drawing characters • Bar graphing characters • Shading characters Slide 27

6.

Putting It All Together Decimal Binary Hexadecimal BCD 0 0 0 0 1 1 1 0001 2 10 2 0010 3 11 3 0011 4 100 4 0100 5 101 5 0101 6 110 6 0110 7 111 7 0111 8 1000 8 1000 9 1001 9 1001 10 1010 A 0001 0000 11 1011 B 0001 0001 12 1100 C 0001 0010 13 1101 D 0001 0011 14 1110 E 0001 0100 15 1111 F 0001 0101 Slide 28

Gray 0 0001 0011 0010 0110 0111 0101 0100 1100 1101 1111 1110 1010 1011 1001 1000

7. Complements of Binary Numbers • 1’s complements • 2’s complements

Slide 29

Complements of Binary Numbers (cont…)

• 1’s complement

Slide 30

Complements of Binary Numbers (cont…)

• 2’s complement

Slide 31

8. Signed Numbers

• • • • •

Signed-magnitude form 1’s and 2’s complement form Decimal value of signed numbers Range of values Floating-point numbers

Slide 32

Signed Numbers (cont…) • Signed-magnitude form – The sign bit is the left-most bit in a signed binary number – A 0 sign bit indicates a positive magnitude – A 1 sign bit indicates a negative magnitude

Slide 33

Signed Numbers (cont…) • 1’s complement form – A negative value is the 1’s complement of the corresponding positive value

• 2’s complement form – A negative value is the 2’s complement of the corresponding positive value

Slide 34

Signed Numbers (cont…) • Decimal value of signed numbers – Sign-magnitude – 1’s complement – 2’s complement

• Range of Values 2’s complement form:

– (2n – 1) to + (2n – 1 – 1)

Slide 35

Signed Numbers (cont…) • Floating-point numbers – Single-precision (32 bits) – Double-precision (64 bits) – Extended-precision (80 bits)

Slide 36

8.1

Arithmetic Operations with Signed Numbers • • • •

Addition Subtraction Multiplication Division

Slide 37

Arithmetic Operations with Signed Numbers (cont…) Addition of Signed Numbers • The parts of an addition function are: – Addend – Augend – Sum Numbers are always added two at a time.

Slide 38

Arithmetic Operations with Signed Numbers (cont…) Four conditions for adding numbers: • Both numbers are positive. • A positive number that is larger than a negative number. • A negative number that is larger than a positive number. • Both numbers are negative.

Slide 39

Arithmetic Operations with Signed Numbers (cont…) Signs for Addition • When both numbers are positive, the sum is positive. • When the larger number is positive and the smaller is negative, the sum is positive. The carry is discarded.

Slide 40

Arithmetic Operations with Signed Numbers (cont…) Signs for Addition • When the larger number is negative and the smaller is positive, the sum is negative (2’s complement form). • When both numbers are negative, the sum is negative (2’s complement form). The carry bit is discarded.

Slide 41

Arithmetic Operations with Signed Numbers (cont…) Subtraction of Signed Numbers • The parts of a subtraction function are: – Subtrahend – Minuend – Difference Subtraction is addition with the sign of the subtrahend changed.

Slide 42

Arithmetic Operations with Signed Numbers (cont…) Subtraction • The sign of a positive or negative binary number is changed by taking its 2’s complement • To subtract two signed numbers, take the 2’s complement of the subtrahend and add. Discard any final carry bit.

Slide 43

Arithmetic Operations with Signed Numbers (cont…) Multiplication of Signed Numbers • The parts of a multiplication function are: – Multiplicand – Multiplier – Product Multiplication is equivalent to adding a number to itself a number of times equal to the multiplier.

Slide 44

Arithmetic Operations with Signed Numbers (cont…) There are two methods for multiplication: • Direct addition • Partial products The method of partial products is the most commonly used.

Slide 45

Arithmetic Operations with Signed Numbers (cont…) Multiplication of Signed Numbers • If the signs are the same, the product is positive. • If the signs are different, the product is negative.

Slide 46

Arithmetic Operations with Signed Numbers (cont…) Division of Signed Numbers • The parts of a division operation are: – Dividend – Divisor – Quotient Division is equivalent to subtracting the divisor from the dividend a number of times equal to the quotient.

Slide 47

Arithmetic Operations with Signed Numbers (cont…) Division of Signed Numbers • If the signs are the same, the quotient is positive. • If the signs are different, the quotient is negative.

Slide 48

9. Parity Method for Error Detection • Binary data and codes are frequently moved between locations. For example: – Digitized voice over a microwave link. – Storage and retrieval of data from magnetic and optical disks. – Communication between computer systems over telephone lines using a modem.

• Electrical noise can cause errors during transmission. • Many digital systems employ methods for error detection (and sometimes correction). Slide 49

Parity Method for Error Detection (cont…) • The parity method of error detection requires the addition of an extra bit to a code group. • This extra bit is called the parity bit. • The bit can be either a 0 or 1, depending on the number of 1s in the code group. • There are two methods, even and odd.

Slide 50

Parity Method for Error Detection (cont…) • Even parity method – the total number of bits in a group including the parity bit must add up to an even number. – The binary group 1 0 1 1 would require the addition of a parity bit 1 1 0 1 1 • Note that the parity bit may be added at either end of a group.

Slide 51

Parity Method for Error Detection (cont…) • Odd parity method – the total number of bits in a group including the parity bit must add up to an odd number. – The binary group 1 1 1 1 would require the addition of a parity bit 1 1 1 1 1

Slide 52

Parity Method for Error Detection (cont…) • The transmitter and receiver must “agree” on the type of parity checking used. • Two bit errors would not indicate a parity error. • Both odd and even parity methods are used, but even seems to be used more often. Slide 53

Parity Method for Error Detection (cont…) • Parity error codes

Slide 54

Parity Method for Error Detection (cont…) • Hamming error codes – Hamming code words – Hex equivalent of the data bits

Slide 55

0000000 0000111 0011011 0011110 0101010 0101101 0110011 0110100 1001011 1001100 1010010 1010101 1100001 1100110 1111000 1111111

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

Related Documents