Digital Logic: Chapter 2 - PowerPoint PPT Presentation

1 / 55
About This Presentation
Title:

Digital Logic: Chapter 2

Description:

Step 2: Conversion will stop at 2n-1 = 26 ... Note, when done on a calculator a decimal remainder can be multiplied by 16 to get the result. ... – PowerPoint PPT presentation

Number of Views:238
Avg rating:5.0/5.0
Slides: 56
Provided by: utm84
Category:

less

Transcript and Presenter's Notes

Title: Digital Logic: Chapter 2


1
Digital LogicChapter 2
  • Number System, Operation And Codes

2
Objectives
  • Review the decimal number system
  • Count in the binary number system
  • Convert from decimal to binary and from binary to
    decimal
  • Apply arithmetic operations to binary numbers
  • Determine the 1's and 2's complements of a binary
    number
  • Express signed binary numbers in sign-magnitude,
    1's complement, 2's complement, and
    floating-point format
  • Carry out arithmetic operations with signed
    binary numbers
  • Convert between the binary and hexadecimal number
    systems
  • Add numbers in hexadecimal form
  • Convert between the binary and octal number
    systems
  • Express decimal numbers in binary coded decimal
    (BCD) form
  • Add BCD numbers
  • Convert between the binary system and the Gray
    code
  • Interpret the American Standard Code for
    Information Interchange (ASCII)
  • Explain how to detect and correct code errors

3
Chapter 2 Overview
  • Numbers
  • Decimal
  • Binary
  • Hexadecimal
  • Octal
  • Conversions
  • Binary Coded Decimal (BCD)
  • Digital Codes and Parity
  • Digital System Application

4
Decimal Numbers
  • The decimal numbering system has 10 digits 0
    through 9
  • The decimal numbering system has a base of 10
    with each position weighted by a factor of 10
  • Express decimal 47 as a sum of the values of each
    digit
  • 47 (4 x 101) (7 x 100) 40 7
    47

5
  • Express the decimal number 568.23 as a sum of the
    values of each digit.

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

7
(No Transcript)
8
Binary Count
9
Binary-to-Decimal Conversion
  • Step 1 Get n, total binary numbers
  • 1101101 ? n 7 binary numbers
  • Step 2 Conversion will stop at 2n-1 26
  • Step 3 Multiply all the numbers with its
    appropriate weight
  • Step 4 Sum the result from step 3, and binary is
    now decimal.

10
  • Step 1 Binary number 100101 ? n 6
  • Step 2 Stop at 2n-1 25

Step 3 multiply
Step 4 sum
11
Decimal to Binary Conversion
  • Two methods to convert decimal to binary
  • Sum-of-weights method
  • Determine the set of binary weights whose sum is
    equal to the decimal number
  • Repeated division-by-2 method
  • Repeatedly dividing the decimal number by 2 and
    retrieving the remainder

12
Sum-of-weight method
  • Binary weights
  • 128 64 32 16 8 4 2 1
  • 357 256 64 32 4 1 101100101
  • 28 27 26 22 20
  • Binary weights
  • 512 256 128 64 32 16 8 4 2 1
  • 1937 1024 512 256 128 16
    1 11110010001

13
Sum-of-weight method
14
(No Transcript)
15
  • Try this for 25 and 125

16
Repeated division-by-2
  • 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.

17
  • This flowchart describes the process and can be
    used to convert from decimal to any other number
    system.

18
(No Transcript)
19
(No Transcript)
20
Converting Decimal Fractions-Binary
  • 2 ways to convert
  • Sum-of-weight
  • Repeated multiplication of 2

21
Sum-of-weights
22
Repeated multiplication by 2
  • Conversion of decimal-binary
  • Whole numbers ? repeated division by 2
  • Fractions ? repeated multiplication by 2
  • Step 1 multiply number by 2
  • Step 2 note the carry (1 or 0)
  • Step 3 repeat with new fraction
  • Stop when fraction part 0

23
(No Transcript)
24
Converting Decimal Fractions-Binary
  • Using Sum-of-weights
  • Binary weights
  • 32 16 8 4 2 1 .5 .25 .125 .0625
  • 95.6875 64 16 8 4 2 1 .5 .125
    .0625
  • 1011111.1011
  • Repeated division by 2 yields the whole number
    while repeated multiplication by 2 of the
    fraction yields the binary fraction

25
(No Transcript)
26
Hexadecimal Number System
  • 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
  • Allows for convenient handling of long binary
    strings.

27
(No Transcript)
28
Hex to Decimal Conversion
  • Convert from hex to decimal by multiplying each
    hex digit by its positional weight.
  • Example

29
Decimal to Hex Conversion
  • Convert using the repeated division method
  • decimal to hex ? divide by 16
  • decimal to octal? divide by 8
  • 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.

30
Decimal-Hex
31
Example
  • Example of hex to binary conversion.
  • 9F216 9 F 2
  • 1001 1111 0010
  • 1001111100102

32
Hex-Binary
33
(No Transcript)
34
Binary to Hex Conversion
  • 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.

35
Example
  • 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.

36
Binary-Hex
37
(No Transcript)
38
Octal Number
  • The Octal Number System
  • uses base 8
  • includes only the digits 0 through 7
  • The Octal system is based on the binary system
    with a 3-bit boundary

39
Octal Number
  • Binary to Octal Conversion
  • (ex 10101111101100102)
  • Octal to Binary Conversion
  • 1276628

40
Binary-Octal
41
(No Transcript)
42
Octal-Binary
43
Octal-Decimal
44
Decimal-Octal
45
Hexadecimal Number System
  • Hex and octal are useful forms of shorthand to
    represent long strings of bits.
  • Understanding the conversion process and
    memorizing the 4 bit patterns for each hex digit
    will prove valuable later.

46
Binary Coded Decimal (BCD)
  • BCD is a way to express each of the decimal
    digits with a binary code.
  • 10 code groups in BCD ? represents 0-9
  • Each code has 4 binary bits
  • There will be invalid codes as 4 bits can
    represent a total of 16
  • Invalid codes in BCD ? 1010, 1011, 1100, 1101,
    1110, 1111 (i.e.10-15)
  • BCD provides excellent interface to binary
    systems ? e.g. keypad inputs, digital readouts

47
(No Transcript)
48
Digital Codes and Parity
  • There are other specialized codes used in digital
    systems ? e.g. Gray code, ASCII code
  • Some codes are
  • strictly numeric e.g. BCD
  • Alphanumeric to represent numbers, letters,
    symbols, instructions e.g. ASCII

49
  • Gray Code
  • Unweighted and is not an arithmetic code
  • Only one bit changes from one code to the next in
    the sequence
  • Gray code can be any amounts of bits.
  • ASCII
  • American Standard Code for Information
    Interchange
  • Has 128 characters and symbols represented in
    7-bit binary code
  • E.g. A 10000012 a 11000012

50
(No Transcript)
51
ASCII example 20 PRINT AX
52
Parity
  • Parity bit used for bit error detection
  • Even parity total number of 1s even
  • Odd parity total number of 1s odd
  • Example (even parity)
  • Code transmitted 00101
  • ?1s total even parity bit 0
  • Code received 00001
  • ?1s total odd parity bit 0 ? error

53
(No Transcript)
54
Try this. Fill in the appropriate parity bit.
55
End of Chapter 2
Write a Comment
User Comments (0)
About PowerShow.com