DLD Chapter1
DLD Chapter1
Example:
A typical analog device is a clock in which the hands move continuously around
the face. Such a clock is capable of indicating every possible time of day. In
contrast, a digital watch is capable of representing only a finite number of
times (e.g. every tenth of a second)
WHY DIGITAL?
Digital systems are easier to design and implement than
analog systems.
Digital data can be processed and transmitted more efficiently
and reliably than analog.
It can store huge amount of data in lesser space and with least
chance of error.
Noise does not affect digital data as compare to analog signals
WHAT IS LOGIC DESIGN?
Digital logic design is a system in electrical and computer engineering that uses
simple number value to produce input and output operations.
Digital logics are rooted in binary code. This system facilitates the design of
electronics circuits that convey information, including logic gates with functions
that include AND, OR and NOT commands.
The value system translates input signals into specific output. These functions
facilitate computing, robotics, and other electronics applications.
Binary Digit
Digital electronics involves circuits and system in which there are two types
possible states.
These states are represented by two different voltage levels: HIGH and LOW.
The two-state number system is called binary and its two digit are called Binary
Digit: 0 and 1.
Binary Digit
Another example of a
digital system, shows
the traffic light
controller.
All of the digital signals
that the system uses to
properly sequence the
traffic light are
internally generated,
making the controller a
type of finite state
machine.
Analog System
An analog system is one that processes data in analog form only. One example is a
public address system, used to amplify sound so that it can be heard by a large
audience.
A Combination Digital And
Analog System
The compact disk (CD) player is an example of a system in which both
digital and analog elements are used. The simplified block diagram in
Figure illustrates the basic system. music in digital form is stored on the
compact disk.
Review Exercise
1. Define analog.
2. Define digital.
3. Explain the difference between a digital quantity and an
analog quantity.
4. Give an example of a system that is analog and one that is a
combination of both digital and analog. Name a system that is
entirely digital.
5. List advantages of Digital over analog
Kibur College
Department of Computer science
26
Introduction to Numbering System
Decimal Numbers
In the decimal number system each of the ten digits 0 through 9 represents a
certain quantity.
The base(radix) of decimal numbers is 10.
The position of each digit in a weight number system is assigned a weight
based on the base of the system.
Powers of ten that increase from right to the column weights of decimal
numbers are left beginning with 10^0 , 10^1 , 10^2,10^3 ...
Decimal Numbers
For fractional decimal numbers, the column weights are negative powers of ten
that decrease from left to right.
Decimal numbers can be expressed as the sum of the products of each digit times
the column values for that digit.
Example
Binary Numbers
1. Sum-of-Weights method
To get the binary number for a given decimal number, find the
binary weights that add up to the decimal number.
Repeated Division-by-2 Method
41
Binary Arithmetic
Binary arithmetic is essential in all digital computers and in many other
types of digital systems.
To understand digital systems, you must know the basics of binary
addition, subtraction, multiplication, and division.
This section provides an introduction that will be expanded in later
sections.
45
Example
46
Example 2
47
Solution
48
Binary Multiplication
49
Example
50
Binary Division Example
51
Checkup
1. Perform the following binary additions:
(a) 1101 + 1010
(b) 10111 + 01101
2. Perform the following binary subtractions:
(a) 1101 - 0100
(b) 1001 - 0111
Perform the indicated binary operations:
(a) 110 * 111
(b) 1100 , 011
52
1’S And 2’S Complements Of
Binary Numbers
The 1’s complement and the 2’s complement of a binary number are important because
they permit the representation of negative numbers.
The method of 2’s complement arithmetic is commonly used in computers to handle
negative numbers.
After completing this section, you should be able to
Convert a binary number to its 1’s complement
Convert a binary number to its 2’s complement using either of two method
53
Finding the 1’s Complement
54
Finding the 2’s Complement
The 2’s complement of a binary number is found by adding 1 to the LSB of the 1’s
complement.
55
Example
56
Signed Numbers
Digital systems, such as the computer, must be able to handle both
positive and negative numbers.
A signed binary number consists of both sign and magnitude
information.
The sign indicates whether A number is positive or negative, and the
magnitude is the value of the number.
There are three forms in which signed integer (whole) numbers can be
represented in binary:
Sign-magnitude,
1’s complement, and
2’s complement.
Of these, the 2’s complement is the most important and the57sign-
magnitude is the least used.
The Sign Bit
The left-most bit in a signed binary number is the sign bit, which
tells you whether the number is positive or negative.
A 0 sign bit indicates A positive number, and A 1 sign
bit indicates A negative number.
58
Sign-magnitude Form
When a signed binary number is represented in sign-magnitude, the left-
most bit is the sign bit and the remaining bits are the magnitude bits.
The magnitude bits are in true (uncomplemented) binary for both positive
and negative numbers.
For example, the decimal number +25 is expressed as an 8-bit signed
binary number using the sign-magnitude form as
59
Cont’d
60
1’s Complement Form
Positive numbers in 1’s complement form are represented the same way as the positive
sign-magnitude numbers.
Negative numbers, however, are the 1’s complements of the corresponding positive numbers.
For example, using eight bits, the decimal number -25 is
expressed as the 1’s complement of +25 (00011001) as 11100110
The 1’s complement form, a negative number is the 1’s complement of the
corresponding positive number.
61
2’s Complement Form
Positive numbers in 2’s complement form are represented the same way as in the sign
magnitude and 1’s complement forms.
Negative numbers are the 2’s complements of the corresponding positive numbers.
Again, using eight bits, let’s take decimal number -25 and express it as the 2’s complement of
+25 (00011001).
Inverting each bit and adding 1, you get
-25 = 11100111
in the 2’s complement form, a negative number is the 2’s complement of the corresponding
positive number
62
Arithmetic Operations With Signed
Numbers
Addition
The two numbers in an addition are the addend and the augend. The result is the sum.
There are four cases that can occur when two signed binary numbers are added.
1. Both numbers positive
2. Positive number with magnitude larger than negative number
3. Negative number with magnitude larger than positive number
4. Both numbers negative
Let’s take one case at a time using 8-bit signed numbers as examples. The equivalent
decimal numbers are shown for reference.
63
64
65
Hexadecimal Numbers
The hexadecimal number system has a base of sixteen; that is, it is composed of 16
numeric and alphabetic characters.
Most digital systems process binary data in groups that are multiples of four bits,
making the hexadecimal number very convenient because each hexadecimal digit
represents a 4-bit binary number.
66
Hexadecimal
Numbers
67
Binary-to-Hexadecimal
Conversion
Converting a binary number to hexadecimal is a
straightforward procedure.
Simply break the binary number into 4-bit groups,
starting at the right-most bit and replace each 4-bit
group with the equivalent hexadecimal symbol.
68
Example
69
Hexadecimal-to-binary
Conversion
To convert from a hexadecimal number to a binary
number, reverse the process and replace each
hexadecimal symbol with the appropriate four bits.
70
Example
71
Hexadecimal-to-decimal
Conversion
One way to find the decimal equivalent of a hexadecimal number is
to first convert the
hexadecimal number to binary and then convert from binary to
decimal.
72
Hexadecimal-to-decimal
Conversion
Another way to convert a hexadecimal number to its decimal
equivalent is to multiply the decimal value of each hexadecimal
digit by its weight and then take the sum of these products.
The weights of a hexadecimal number are increasing powers of
16 (from right to left).
For a 4-digit hexadecimal number, the weights are
73
Example
74
Decimal-to-Hexadecimal
Conversion
Repeated division of a decimal number by 16 will produce the
equivalent hexadecimal number, formed by the remainders of
the divisions.
The first remainder produced is the least significant digit
(LSD).
Each successive division by 16 yields a remainder that
becomes a digit in the equivalent hexadecimal number.
75
Example
76
Hexadecimal addition
Addition can be done directly with hexadecimal numbers by remembering
that the hexadecimal digits 0 through 9 are equivalent to decimal digits 0
through 9 and that hexadecimal digits A through F are equivalent to decimal
numbers 10 through 15.
When adding two hexadecimal numbers, use the following rules. (Decimal
numbers are indicated by a subscript 10.)
1. In any given column of an addition problem, think of the two
hexadecimal digits in
terms of their decimal values. For instance, 516 = 510 and C16 =
1210.
2. If the sum of these two digits is 1510 or less, bring down the
corresponding hexadecimal digit.
3. If the sum of these two digits is greater than 1510, bring down the
amount of the sum 77
78
Exercise
Add 4C16 and 3A16
79
Binary Coded Decimal (BCD)
80
The 8421 BCD Code
81
Invalid Codes
Invalid Codes you should realize that, with four bits, sixteen
numbers (0000
through 1111) can be represented but that, in the 8421 code,
only ten of these are used.
The six code combinations that are not used—1010, 1011,
1100, 1101, 1110, and 1111—are invalid in the 8421 BCD
code.
82
Example
83
Applications of BCD
84
BCD addition
BCD is a numerical code and can be used in arithmetic operations.
Addition is the most important operation because the other three operations (subtraction,
multiplication, and division) can be accomplished by the use of addition.
86
Cont’d
87
Exercise
1. Convert hexadecimal number 4100 to binary:
2. Convert binary number 1111110000 to hexadecimal:
3. Convert hexadecimal number F3 to decimal:
4. Convert decimal number 6500 to hexadecimal:
5. Perform the additions hexadecimal number: A0 + 6B
6. Add the following BCD numbers:
A. 01010001 + 01011000
B. 10011000 + 10010111
88
End Of The Chapter
89
Chapter Three:
Logic Gates
90
Logic Gates
Are the building blocks of digital electronics.
The term gate is used to describe a circuit that performs a basic logic operations.
The fundamental logic gates include the NOT, AND, OR, NAND, NOR, X-OR, X-
NOR gates.
Each of these gates performs a different logical operations
91
The INVERTER
92
Inverter Operation
93
The AND Gate
An AND gate can have two or more inputs and performs what is know as logical
multiplication.
The AND gate is composed of two or more inputs and a single output, as indicated by the
standard logic symbols shown in Figure
94
Operation Of An And Gate
An AND gate produces a high output only when all of the inputs are high. When any
of the inputs is LOW, the output is LOW.
Therefore, the basic purpose of an AND gate is to determine when certain conditions
are simultaneously true, as indicated by high levels on all of its inputs, and to produce
a high on its output to indicate that all these conditions are true.
For a 2-input and gate, output X is high only when inputs A and B are
high; X is low when either A or B is low, or when both A and B are low.
95
Truth Table For A 2-input AND Gate.
96
Logic expressions for AND gates
X = AB
.
97
Check-up
98
THE OR GATE
An OR gate has two or more inputs and one output, as indicated by the
standard logic symbols in Figure , where OR gates with two inputs are
illustrated.
99
OPERATION OF AN OR GATE
100
Logic expressions for or gates
101
THE NAND GATE
102
Operation Of A NAND Gate
A NAND gate produces a LOW output only when all the inputs are HIGH. When any of the inputs
is LOW, the output will be HIGH.
For the specific case of a 2-input NAND gate,
as shown below with the inputs labeled A and B and the output labeled X, the operation can be
stated as follows:
For a 2-input NAND gate, output X is LOW only when inputs A and B are
HIGH; X is HIGH when either A or B is LOW, or when both A and B are LOW.
103
System Example:Storage Tank High-level Detection
104
Logic Expressions For NAND
Gates
The Boolean expression for the output of a 2-input
NAND gate is
105
Check-Up
106
THE NOR GATE
The NOR gate, like the NAND gate, is a useful logic element because it can also be used as a
universal gate; that is, NOR gates can be used in combination to perform the AND, OR, and
INVERTER operations.
The term NOR is a contraction of NOT-OR and implies an OR function with an
inverted (complemented) output.
The standard logic symbol for a 2-input NOR gate and its equivalent OR gate followed by
an inverter are shown in Figure
107
Operation Of A NOR Gate
• A nor gate produces a LOW output when any of its
inputs is HIGH.
• Only when all of its inputs are LOW is the output HIGH.
• For the specific case of a 2-input NOR gate, as shown
in Figure with the inputs labeled A and B and the
output labeled X, the operation can be
stated as follows:
• For a 2-input nor gate, output X is LOW when
either input A or input B is HIGH, or when both
A and B are HIGH; X is HIGH only when both A
and B are LOW 108
Logic Expressions For NOR
Gates
The Boolean expression for the output of a 2-input NOR gate can be
written as
109
THE EXCLUSIVE-OR AND
EXCLUSIVE-NOR GATES
Exclusive-or and exclusive-nor gates are formed by a
combination of and gates, or gates, and inverters.
110
THE EXCLUSIVE-OR GATE
Standard symbols for an exclusive-OR (XOR for short) gate are shown in Figure .
The XOR gate has only two inputs. The exclusive-or gate performs modulo-2
addition.
The output of an exclusive-OR gate is HIGH only when the two inputs are at
opposite logic levels.
This operation can be stated as follows with reference to inputs A and B and
output X:
For an exclusive-or gate, output X is HIGH when input A is LOW and input
B is HIGH, or when input A is HIGH and input B is LOW; X is LOW when A
and B are both HIGH or both LOW.
111
TRUTH TABLE FOR AN
EXCLUSIVEOR GATE.
112
THE EXCLUSIVE-NOR GATE
Standard symbols for an EXCLUSIVE-NOR (XNOR) gate are shown in Figure.
Like the XOR gate, an XNOR has only two inputs.
The bubble on the output of the XNOR symbol indicates that its output is opposite that of the XOR
gate.
When the two input logic levels are opposite, the output of the exclusive-NOR gate is LOW. The
operation can be stated as follows (A and B are inputs, X is the output):
For an exclusive-nor gate, output X is LOW when input A is LOW and input B is HIGH, or
when A is HIGH and B is LOW; X is HIGH when A and B are both HIGH or both LOW.
113
TRUTH TABLE FOR AN EXCLUSIVE NOR
GATE.
114
LOGIC EXPRESSIONS FOR THE XOR
AND XNOR GATES
115
Check-Up
116
Check-up
2.In a certain automated manufacturing process, electrical components are automatically inserted in a
PC board. Before the insertion tool is activated, the PC board must be properly positioned, and the
component to be inserted must be in the chamber. Each of these prerequisite conditions is indicated by
a HIGH voltage. The insertion tool requires a LOW voltage to activate it. Develop a circuit to
implement this process
117