Digital Electronics Chapter 2
Digital Electronics Chapter 2
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
Course Outcome
1. Explain number systems, codes, digital arithmetic operation
and circuits.
2. Use Boolean algebra and Karnaugh Maps to minimize
Boolean expressions for the design of digital logic circuits.
3. Explain and use flip-flops, latches, counters, multiplexers and
de-multiplexers.
4. Design and construct combinational digital logic circuits
using appropriate logic design techniques.
5. Design and construct synchronous sequential digital logic
circuits using appropriate logic design techniques.
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
OUTLINE
1. Decimal Numbers
2. Binary Numbers
3. Decimal-to-Binary Conversion
4. Binary Arithmetic
5. Complements of Binary Numbers
6. Signed Numbers
7. Arithmetic Operations with Signed Numbers
8. Hexadecimal Numbers
9. Octal Numbers
10. Binary Coded Decimal (BCD)
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
Decimal Numbers
The position of each digit in a weighted number system is
assigned a weight based on the base or radix of the system.
The radix of decimal numbers is ten, because only ten
symbols (0 through 9) are used to represent any number.
Weight : 26 25 24 23 22 21 20
Binary number : 1 1 0 1 1 0 1
1101101 = 26 + 25 + 23 + 22+ 20
= 64 + 32 +8 + 4 + 1 = 109
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
Binary to Decimal Conversion
Convert the fractional binary number 0.1011 to decimal
Binary number : 0. 1 0 1 1
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
Binary to Decimal Conversion
The decimal equivalent of a binary number can be determined
by adding the column values of all of the bits that are 1 and
discarding all of the bits that are 0.
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
Decimal to Binary Conversion
You can convert a decimal whole number to binary by
reversing the procedure. Write the decimal weight of each
column and place 1’s in the columns that sum to the decimal
number.
26 25 24 2 3 22 21 20.
64 32 16 8 4 2 1.
0 1 1 0 0 0 1.
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
Decimal to Binary Conversion
You can convert decimal to any other base by repeatedly
dividing by the base. For binary, repeatedly divide by 2:
19 / 2 = 9 Remainder = 1
9/2=4 Remainder = 1
4/2=2 Remainder = 0
2/2=1 Remainder = 0
1/2=0 Remainder = 1
Answer = 1 0 0 1 1
MSB LSB
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
Decimal to Binary Conversion
Convert the decimal number 49 to binary by
repeatedly dividing by 2.
Answer: 1 1 0 0 0 1 remainder
0 1 3 6 12 24 49 2
Continue until the Decimal
Quotient base
last quotient is 0 number
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
Decimal to Binary Conversion
You can convert a decimal fraction to binary by repeatedly
multiplying the fractional results of successive multiplications
by 2. The carries form the binary number.
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
Binary Addition
The rules for binary addition are
0+0=0 Sum = 0, carry = 0
0+1=0 Sum = 1, carry = 0
1+0=0 Sum = 1, carry = 0
1 + 1 = 10 Sum = 0, carry = 1
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
Binary Addition
Add the binary numbers 00111 and 10101 and show
the equivalent decimal addition.
0111
00111 7
10101 21
11100 = 28
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
Binary Subtraction
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
Binary Multiplication and Division
00 01 11
111 110 101010
0
x 101 10
111 0
000* 101
111* * 0
10 0 0 1 1 1010
110
1001
110
0 1 10
110
000
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
1’s Complement
The 1’s complement of a binary number is just the inverse
of the digits. To form the 1’s complement, change all 0’s to
1’s and all 1’s to 0’s.
0 0 1 1 0 1 0 1
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
2’s Complement
The 2’s complement of a binary number is found by adding
1 to the LSB of the 1’s complement.
Recall that the 1’s complement of 11001010 is
00110101 (1’s complement)
To form the 2’s complement, add 1: +1
1 1 0 0 1 0 1 0 00110110 (2’s complement)
1
0 0 1 1 0 1 0 1
Input bits
Carry
Adder
in (add 1)
Output bits (sum)
0 0 1 1 0 1 1 0
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
Signed Binary Numbers
There are several ways to represent signed binary numbers.
In all cases, the MSB in a signed number is the sign bit, that
tells you if the number is positive or negative.
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
Signed Binary Numbers
Negative numbers are written as the 2’s complement of the
corresponding positive number.
The negative number -58 is written as:
-58 = 11000110 (complement form)
Sign bit Magnitude bits
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
Arithmetic Operations with Signed
Numbers
Using the signed number notation with negative numbers
in 2’s complement form simplifies addition and subtraction
of signed numbers.
Rules for addition: Add the two signed numbers. Discard
any final carries. The result is in signed form.
Examples:
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
Arithmetic Operations with Signed
Numbers
Note that if the number of bits required for the answer is
exceeded, overflow will occur. This occurs only if both
numbers have the same sign. The overflow will be
indicated by an incorrect sign bit.
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
Arithmetic Operations with Signed
Numbers
Rules for subtraction: 2’s complement the subtrahend and
add the numbers. Discard any final carries. The result is in
signed form.
Repeat the examples done previously, but subtract:
00011110 (+30) 00001110 (+14) 11111111 (-1)
- 00001111 –(+15) - 11101111 –(-17) - 11111000 –(-8)
2’s complement subtrahend and add:
00011110 = +30 00001110 = +14 11111111 = -1
11110001 = -15 00010001 = +17 00001000 = +8
1 00001111 = +15 00011111 = +31 1 00000111 = +7
Discard carry Discard carry
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
Hexadecimal Numbers
Hexadecimal uses sixteen characters to Decimal Hexadecimal Binary
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
Hexadecimal Numbers
Decimal Hexadecimal Binary
Hexadecimal is a weighted number
0 0 0000
system. The column weights are
1 1 0001
powers of 16, which increase from 2 2 0010
right to left. 3 3 0011
4 4 0100
Column weights {4096 3
16 16 16 16 .
256 16 1 .
2 1 0
5 5 0101
6 6 0110
7 7 0111
Express 1A2F16 in decimal. 8 8 1000
9 9 1001
Start by writing the column weights: 10 A 1010
4096 256 16 1 11 B 1011
1 A 2 F16 12 C 1100
13 D 1101
1(4096) + 10(256) +2(16) +15(1) = 670310
14 E 1110
15 F 1111
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
Octal Numbers
Octal uses eight characters the numbers Decimal Octal Binary
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
Binary coded decimal (BCD)
Binary coded decimal (BCD) is a Decimal Binary BCD
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
Binary coded decimal (BCD)
You can think of BCD in terms of column weights in
groups of four bits. For an 8-bit BCD number, the column
weights are: 80 40 20 10 8 4 2 1.
Note that you could add the column weights where there is a 1 to
obtain the decimal number. For this case:
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
BCD Addition
These are three cases for BCD addition:
1. If a 4-bit sum is equal to or less than 9 and final carry = 0 ,
the results is valid BCD number.
2. If a 4-bit sum is equal to or less than 9 and final carry = 1 ,
the results is invalid BCD number and we have to add 6.
3. If a 4-bit sum is greater than 9 and final carry = 0 , the
results is invalid BCD number and we have to add 6.
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
Gray code
Gray code is an unweighted code that has a single bit change
between one code word and the next in a sequence. Gray code is
used to avoid problems in systems where an error can occur if
more than one bit changes at a time.
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
Binary to Gray code Conversion
Decimal Binary Gray code
Convert the binary number 0 0000 0000
11000110 to Cray code 1 0001 0001
2 0010 0011
3 0011 0010
11000110 = 10100101 4 0100 0110
5 0101 0111
6 0110 0101
7 0111 0100
8 1000 1100
9 1001 1101
10 1010 1111
11 1011 1110
12 1100 1010
13 1101 1011
14 1110 1001
15 1111 1000
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
Gray code to Binary Conversion
These are three steps:
1. Record the MSB as it is.
2. Add MSB to the next bit of Gray code, record the sum and
neglect the carry.
3. Repeat the process.
10101111 = 11001010
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
ASCII
American Standard Code for Information Interchange
(ASCII) is a code for alphanumeric characters and control
characters. In its original form, ASCII encoded 128 characters
and symbols using 7-bits. The first 32 characters are control
characters, that are based on obsolete teletype requirements,
so these characters are generally assigned to other functions
in modern usage.
In 1981, IBM introduced extended ASCII, which is an 8-bit
code and increased the character set to 256. Other extended
sets (such as Unicode) have been introduced to handle
characters in languages other than English.
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
Parity Method
The parity method is a method of error detection for simple
transmission errors involving one bit (or an odd number of
bits). A parity bit is an “extra” bit attached to a group of bits
to force the number of 1’s to be either even (even parity) or
odd (odd parity).
The ASCII “a” has an odd number of bits that are equal to 1;
therefore the parity bit is 0. The ASCII “A” has an even
number of bits that are equal to 1; therefore the parity bit is 1.
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
Cyclic Redundancy Check
The cyclic redundancy check (CRC) is an error detection method that
can detect multiple errors in larger blocks of data. At the sending end,
a checksum is appended to a block of data. At the receiving end, the
check sum is generated and compared to the sent checksum. If the
check sums are the same, no error is detected.
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
Quiz
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
Quiz
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
Quiz
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
Quiz
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
Quiz
5. Assume that a floating point number is represented in
binary. If the sign bit is 1, the
a. number is negative
b. number is positive
c. exponent is negative
d. exponent is positive
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
Quiz
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
Quiz
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
Quiz
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
Quiz
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
Quiz
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved
Quiz
Answers:
1. c 6. a
2. b 7. d
3. c 8. d
4. b 9. b
5. a 10. c
Digital Fundamentals, Eleventh Edition, Global Edition Copyright © 2016 by Pearson Education, Ltd.
Thomas L. Floyd All Rights Reserved