Professional Documents
Culture Documents
CHAPTER 2
Number Systems
and Codes
Edited by
Jerry Bernardini
Digital Systems, Twelfth Edition Copyright © 2017, 2010, 2006 by Pearson Education, Inc.
Neal Widmer, Gregory Moss, & Ronald Tocci All Rights Reserved
Chapter 2 Objectives
Digital Systems, Twelfth Edition Copyright © 2017, 2010, 2006 by Pearson Education, Inc.
Neal Widmer, Gregory Moss, & Ronald Tocci All Rights Reserved
2-1 Binary to Decimal Conversion
• Convert binary to decimal by summing
the positions that contain a 1:
Neal Widmer, Gregory Moss, & Ronald Tocci All Rights Reserved
2-1 Double-Dabble Binary to
Decimal Conversion
• Binary numbers verify the double-dabble method:
Neal Widmer, Gregory Moss, & Ronald Tocci All Rights Reserved
Binary-Decimal- Weight Method
2n 27 26 25 24 23 22 21 20
weight 128 64 32 16 8 4 2 1
example 1 0 1 0 1 0 1 0
1 128
1 32
1 8
1 2
sum 170
Digital Systems, Twelfth Edition Copyright © 2017, 2010, 2006 by Pearson Education, Inc.
Neal Widmer, Gregory Moss, & Ronald Tocci All Rights Reserved
Decimal to Binary Weight Method
2n 27 26 25 24 23 22 21 20
example 7510
0 1 0 0 -64
11
1 0 1 -8
-2
1 1
Result 0 1 0 0 1 0 1 1
Digital Systems, Twelfth Edition Copyright © 2017, 2010, 2006 by Pearson Education, Inc.
Neal Widmer, Gregory Moss, & Ronald Tocci All Rights Reserved
2-2 Decimal to Binary Conversion
Repeated Division
•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.
•The last is the MSB.
Neal Widmer, Gregory Moss, & Ronald Tocci All Rights Reserved
2-3 Hexadecimal Number System
Neal Widmer, Gregory Moss, & Ronald Tocci All Rights Reserved
2-3 Hexadecimal Number System
Relationships between
hexadecimal, decimal,
and binary numbers.
Neal Widmer, Gregory Moss, & Ronald Tocci All Rights Reserved
2-3 Hexadecimal Number System
– Hex to Decimal
• Convert from hex to decimal by
multiplying each hex digit by its
positional weight.
• In a 2nd example, the value 10 was substituted
for A and 15 substituted for F.
Neal Widmer, Gregory Moss, & Ronald Tocci All Rights Reserved
2-3 Hexadecimal Number System
– Decimal to Hex
• Convert from decimal to hex by using
the repeated division method used for
decimal
to binary conversion.
• Divide the decimal number by 16
The first remainder is the LSB—the last
is the MSB.
Neal Widmer, Gregory Moss, & Ronald Tocci All Rights Reserved
2-3 Hexadecimal Number System
– Decimal to Hex
• Convert 42310 to hex:
Neal Widmer, Gregory Moss, & Ronald Tocci All Rights Reserved
2-3 Hexadecimal Number System
– Decimal to Hex
• Convert 21410 to hex:
Neal Widmer, Gregory Moss, & Ronald Tocci All Rights Reserved
2-3 Hexadecimal Number System
– Hex to Binary
• Divide binary number into groups of four bits
(nibble)
• Convert nibble to hex
Neal Widmer, Gregory Moss, & Ronald Tocci All Rights Reserved
2-3 Hexadecimal Number System
– Binary to Hex
• group bits in four starting with the LSB
Each group is then converted to the hex
equivalent
binary number is grouped into groups of
four bits & each is converted to its
equivalent hex digit.
Neal Widmer, Gregory Moss, & Ronald Tocci All Rights Reserved
2-3 Hexadecimal Number System
– Decimal to Hex to Binary
• Convert decimal 378 to a 16-bit binary
• Perform successive division by 16
• Remainder in hex is each hex value
37810 = 17A16
Digital Systems, Twelfth Edition Copyright © 2017, 2010, 2006 by Pearson Education, Inc.
Neal Widmer, Gregory Moss, & Ronald Tocci All Rights Reserved
Binary Coded Decimal -BCD Code
Neal Widmer, Gregory Moss, & Ronald Tocci All Rights Reserved
2-4 BCD Code
Neal Widmer, Gregory Moss, & Ronald Tocci All Rights Reserved
2-4 BCD Code
Neal Widmer, Gregory Moss, & Ronald Tocci All Rights Reserved
2-4 BCD Code
Neal Widmer, Gregory Moss, & Ronald Tocci All Rights Reserved
2-4 BCD Code
Neal Widmer, Gregory Moss, & Ronald Tocci All Rights Reserved
2-5 The Gray Code
Neal Widmer, Gregory Moss, & Ronald Tocci All Rights Reserved
2-5 The Gray Code
Neal Widmer, Gregory Moss, & Ronald Tocci All Rights Reserved
Decimal-Binary-Hex-BCD-Gray
Decimal numbers 1 – 15 in binary, hex, BCD, Gray
Neal Widmer, Gregory Moss, & Ronald Tocci All Rights Reserved
2-7 The Byte, Nibble, and Word
Neal Widmer, Gregory Moss, & Ronald Tocci All Rights Reserved
Byte-Nibble-Word
1 byte = 8 bits
1 nibble = 4 bits
1 word = Variable ( 8, 16, 32, 64 bits )
Word size depends upon the digital system
• PC word size could be 32 or 64 bits
Digital Systems, Twelfth Edition Copyright © 2017, 2010, 2006 by Pearson Education, Inc.
Neal Widmer, Gregory Moss, & Ronald Tocci All Rights Reserved
American Standard Code for Information
Interchange -ASCII
Neal Widmer, Gregory Moss, & Ronald Tocci All Rights Reserved
ASCII – Codes
Neal Widmer, Gregory Moss, & Ronald Tocci All Rights Reserved
ASCII – Codes Examples
Neal Widmer, Gregory Moss, & Ronald Tocci All Rights Reserved
Transmission Errors
Neal Widmer, Gregory Moss, & Ronald Tocci All Rights Reserved
Error Detection and Correction
Digital Systems, Twelfth Edition Copyright © 2017, 2010, 2006 by Pearson Education, Inc.
Neal Widmer, Gregory Moss, & Ronald Tocci All Rights Reserved
Parity Method for Error Detection
Neal Widmer, Gregory Moss, & Ronald Tocci All Rights Reserved
Parity Method for Error Detection
Neal Widmer, Gregory Moss, & Ronald Tocci All Rights Reserved
2-9 Parity Method for Error
Detection
• 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, making
the group 1 1 1 1 1.
1
Neal Widmer, Gregory Moss, & Ronald Tocci All Rights Reserved
ASCII Transmission
Digital Systems, Twelfth Edition Copyright © 2017, 2010, 2006 by Pearson Education, Inc.
Neal Widmer, Gregory Moss, & Ronald Tocci All Rights Reserved
Boolean Algebra and Common Logic
Digital Systems, Twelfth Edition Copyright © 2017, 2010, 2006 by Pearson Education, Inc.
Neal Widmer, Gregory Moss, & Ronald Tocci All Rights Reserved
OR Gates
x=A+B x=1+1+1=1
x = A + B is read as “x equals A OR B
Digital Systems, Twelfth Edition Copyright © 2017, 2010, 2006 by Pearson Education, Inc.
Neal Widmer, Gregory Moss, & Ronald Tocci All Rights Reserved
AND Gate
x=A B
Digital Systems, Twelfth Edition Copyright © 2017, 2010, 2006 by Pearson Education, Inc.
Neal Widmer, Gregory Moss, & Ronald Tocci All Rights Reserved
NOT Gate
Digital Systems, Twelfth Edition Copyright © 2017, 2010, 2006 by Pearson Education, Inc.
Neal Widmer, Gregory Moss, & Ronald Tocci All Rights Reserved
Combining Logic Gates
Digital Systems, Twelfth Edition Copyright © 2017, 2010, 2006 by Pearson Education, Inc.
Neal Widmer, Gregory Moss, & Ronald Tocci All Rights Reserved
Operator Precedence
Digital Systems, Twelfth Edition Copyright © 2017, 2010, 2006 by Pearson Education, Inc.
Neal Widmer, Gregory Moss, & Ronald Tocci All Rights Reserved