C1-Number Systems and Codes
C1-Number Systems and Codes
Digital Systems: Principles and Applications, 11/e Copyright © 2011, 2007, 2004, 2001, 1998 by Pearson Education, Inc.
Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss Upper Saddle River, New Jersey 07458 • All rights reserved
Copyright © 2011, 2007, 2004, 2001, 1998 by Pearson Education, Inc. Copyright © 2011, 2007, 2004, 2001, 1998 by Pearson Education, Inc.
Upper Saddle River, New Jersey 07458 • All rights reserved Upper Saddle River, New Jersey 07458 • All rights reserved
1
2/14/2023
• The double-dabble method avoids addition of • Binary numbers verify the double-dabble method:
large numbers:
– Write down the left-most 1 in the binary number.
– Double it and add the next bit to the right.
– Write down the result under the next bit.
– Continue with steps 2 and 3 until finished with
the binary number.
Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss Upper Saddle River, New Jersey 07458 • All rights reserved Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss Upper Saddle River, New Jersey 07458 • All rights reserved
Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss Upper Saddle River, New Jersey 07458 • All rights reserved Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss Upper Saddle River, New Jersey 07458 • All rights reserved
2
2/14/2023
Repeated Problems
Division
This flowchart
describes the
process and can
be used to convert
from decimal to
any other number
system.
Relationships between
hexadecimal, decimal,
and binary numbers.
Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss Upper Saddle River, New Jersey 07458 • All rights reserved Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss Upper Saddle River, New Jersey 07458 • All rights reserved
3
2/14/2023
1-3 Hexadecimal Number System – Hex to Decimal 1-3 Hexadecimal Number System – Decimal to Hex
• Convert from hex to decimal by multiplying • Convert from decimal to hex by using the
each hex digit by its positional weight. 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.
Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss Upper Saddle River, New Jersey 07458 • All rights reserved Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss Upper Saddle River, New Jersey 07458 • All rights reserved
1-3 Hexadecimal Number System – Decimal to Hex 1-3 Hexadecimal Number System – Decimal to Hex
Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss Upper Saddle River, New Jersey 07458 • All rights reserved Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss Upper Saddle River, New Jersey 07458 • All rights reserved
4
2/14/2023
1-3 Hexadecimal Number System – Hex to Binary 1-3 Hexadecimal Number System – Binary to Hex
• Leading zeros can be added to the left of the MSB • Convert from binary to hex by grouping bits in four
to fill out the last group. starting with the LSB.
– Each group is then converted to the hex equivalent
• The binary number is grouped into groups of four
bits & each is converted to its equivalent hex digit.
Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss Upper Saddle River, New Jersey 07458 • All rights reserved Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss Upper Saddle River, New Jersey 07458 • All rights reserved
1-3 Hexadecimal Number System – Decimal to Hex to Binary 1-3 Hexadecimal Number System
To perform conversions
between hex & binary, it
is necessary to know the
four-bit binary numbers
(0000 - 1111), and their
equivalent hex digits.
Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss Upper Saddle River, New Jersey 07458 • All rights reserved Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss Upper Saddle River, New Jersey 07458 • All rights reserved
5
2/14/2023
Example:
38,39,3A,3B,3C,3D,3E,3F,40,41,42
When there is a 9 in a digit position, it
becomes an A when it is incremented.
Digital Systems: Principles and Applications, 11/e Copyright © 2011, 2007, 2004, 2001, 1998 by Pearson Education, Inc. Copyright © 2011, 2007, 2004, 2001, 1998 by Pearson Education, Inc.
Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss Upper Saddle River, New Jersey 07458 • All rights reserved Upper Saddle River, New Jersey 07458 • All rights reserved
Problems Problems
Copyright © 2011, 2007, 2004, 2001, 1998 by Pearson Education, Inc. Copyright © 2011, 2007, 2004, 2001, 1998 by Pearson Education, Inc.
Upper Saddle River, New Jersey 07458 • All rights reserved Upper Saddle River, New Jersey 07458 • All rights reserved
6
2/14/2023
Upper Saddle River, New Jersey 07458 • All rights reserved Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss Upper Saddle River, New Jersey 07458 • All rights reserved
Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss Upper Saddle River, New Jersey 07458 • All rights reserved Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss Upper Saddle River, New Jersey 07458 • All rights reserved
7
2/14/2023
Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss Upper Saddle River, New Jersey 07458 • All rights reserved Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss Upper Saddle River, New Jersey 07458 • All rights reserved
8
2/14/2023
Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss Upper Saddle River, New Jersey 07458 • All rights reserved Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss Upper Saddle River, New Jersey 07458 • All rights reserved
9
2/14/2023
1-10 Parity Method for Error Detection 1-10 Parity Method for Error Detection
• Binary data and codes are frequently moved • Electrical noise can cause errors during
between locations: transmission.
– Digitized voice over a microwave link. – Spurious fluctuations in voltage or current present
– Storage/retrieval of data from magnetic/optical disks. in all electronic systems.
– Communication between computer systems
over telephone lines, using a modem.
Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss Upper Saddle River, New Jersey 07458 • All rights reserved Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss Upper Saddle River, New Jersey 07458 • All rights reserved
1-10 Parity Method for Error Detection 1-10 Parity Method for Error Detection
• The parity method of error detection requires the • Even parity method—the total number of 1s in
addition of an extra bit to a code group. a group including the parity bit must add up to
– Called the parity bit, it can be either a 0 or 1, an even number.
depending on the number of 1s in the code group. – The binary group 1 0 1 1 would require the addition
• There are two parity methods, even and odd. of a parity bit 1, making the group 1 1 0 1 1.
• The parity bit may be added at either end of a group.
– The transmitter and receiver must “agree” on
the type of parity checking used.
• Even seems to be used more often.
Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss Upper Saddle River, New Jersey 07458 • All rights reserved Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss Upper Saddle River, New Jersey 07458 • All rights reserved
10
2/14/2023
1-10 Parity Method for Error Detection 1-4 Representing signed numbers
Digital Systems: Principles and Applications, 11/e Copyright © 2011, 2007, 2004, 2001, 1998 by Pearson Education, Inc. Digital Systems: Principles and Applications, 11/e Copyright © 2011, 2007, 2004, 2001, 1998 by Pearson Education, Inc.
Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss Upper Saddle River, New Jersey 07458 • All rights reserved Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss Upper Saddle River, New Jersey 07458 • All rights reserved
11
2/14/2023
Representing Signed Numbers Using 2’s Complement: Representing Signed Numbers Using 2’s Complement:
- the number is positive, the magnitude is represented
in its true binary form, and a sign bit of 0 is placed
in front of the MSB
- the number is negative, the magnitude is
represented in its 2’s complement form, and a sign
bit of 1 is placed in front of the MSB
Digital Systems: Principles and Applications, 11/e Copyright © 2011, 2007, 2004, 2001, 1998 by Pearson Education, Inc. Digital Systems: Principles and Applications, 11/e Copyright © 2011, 2007, 2004, 2001, 1998 by Pearson Education, Inc.
Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss Upper Saddle River, New Jersey 07458 • All rights reserved Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss Upper Saddle River, New Jersey 07458 • All rights reserved
1-5 Addition in the 2’s complement system 1-5 Addition in the 2’s complement system
Digital Systems: Principles and Applications, 11/e Copyright © 2011, 2007, 2004, 2001, 1998 by Pearson Education, Inc. Digital Systems: Principles and Applications, 11/e Copyright © 2011, 2007, 2004, 2001, 1998 by Pearson Education, Inc.
Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss Upper Saddle River, New Jersey 07458 • All rights reserved Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss Upper Saddle River, New Jersey 07458 • All rights reserved
12
2/14/2023
1-5 Addition in the 2’s complement system 1-5 Addition in the 2’s complement system
Positive Number and Larger Negative Number Equal and Opposite Numbers
Digital Systems: Principles and Applications, 11/e Copyright © 2011, 2007, 2004, 2001, 1998 by Pearson Education, Inc. Digital Systems: Principles and Applications, 11/e Copyright © 2011, 2007, 2004, 2001, 1998 by Pearson Education, Inc.
Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss Upper Saddle River, New Jersey 07458 • All rights reserved Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss Upper Saddle River, New Jersey 07458 • All rights reserved
1-5 Subtraction in the 2’s complement system 1-5 Subtraction in the 2’s complement system
Digital Systems: Principles and Applications, 11/e Copyright © 2011, 2007, 2004, 2001, 1998 by Pearson Education, Inc. Digital Systems: Principles and Applications, 11/e Copyright © 2011, 2007, 2004, 2001, 1998 by Pearson Education, Inc.
Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss Upper Saddle River, New Jersey 07458 • All rights reserved Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss Upper Saddle River, New Jersey 07458 • All rights reserved
13
2/14/2023
The same manner as the multiplication of decimal The same as that followed for decimal numbers
numbers
Digital Systems: Principles and Applications, 11/e Copyright © 2011, 2007, 2004, 2001, 1998 by Pearson Education, Inc. Digital Systems: Principles and Applications, 11/e Copyright © 2011, 2007, 2004, 2001, 1998 by Pearson Education, Inc.
Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss Upper Saddle River, New Jersey 07458 • All rights reserved Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss Upper Saddle River, New Jersey 07458 • All rights reserved
END
14