Lectures
Lectures
58 3AF 58
+ 24 + 23C + 4B
7C 5EB 93
Remember that hex numbers are just an efficient way to represent binary
numbers. Thus we can subtract hex numbers using the same method we used for
binary numbers. In order to find the complement of hex numbers, two ways are
found
first way: 7 3 A hex number
0111 0011 1010 convert to binary
1000 1100 0101 1’s complement representation
1000 1100 0110 2’s complement representation
8 C 6 conversion back to hex
Second way: this procedure is quicker, subtract each hex digit from F, and
then add 1. let’s try this for the same hex number from the example above:
F F F
-7 -3 -A Subtract each digit from F
8 C 5
+1 adding 1
8 C 6 hex. Equivalent of 2’s comp.
592
Discarded + C5B
carry 1 1ED
2
University of Anbar Subject / Digital TechniquesI
College of Engineering Second Stage / 1st Semester
Dept. of Electrical Engineering (2021 – 2022);lecture 3
ـــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ
Example: subtract the following hexadecimal numbers:
(a) 84 – 2A (b) C3 – 0B
C3
+ F5
Drop carry 1 B8 the difference is B8(16)
3
University of Anbar Subject / Digital TechniquesI
College of Engineering Second Stage / 1st Semester
Dept. of Electrical Engineering (2021 – 2022);lecture 3
ـــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ
2- AND Gate:
The AND Gate is one of the basic gates from which all logic functions are
constructed. An AND gate can have two or more inputs and performs what is
known as logical multiplication. Figure below, all possible logic levels for a 2-
input AND gate.
Inputs Output
Logic Symbol
A B X
0 0 0 A
X
0 1 0 B
1 0 0
1 1 1
4
University of Anbar Subject / Digital TechniquesI
College of Engineering Second Stage / 1st Semester
Dept. of Electrical Engineering (2021 – 2022);lecture 3
ـــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ
3- OR Gate:
The OR gate is one of the basic gates from which all logic functions are
constructed. An OR gate can have two or more inputs and performs what is know
as logical addition. Figure below, all possible logic levels for a 2-input OR gate.
OR Gate Truth Table
Inputs Output
Logic Symbol
A B X
0 0 0 A
X
0 1 1 B
1 0 1
1 1 1
4- NAND Gate:
The NAND gate is a popular logic element because it can be used as a
universal gate; that is; NAND gate can be used to perform the AND, OR, and
Inverter operations, or any combination of these operations. The term NAND is a
contraction of NOT-AND and implies an AND function with a complemented
(Inverted) output. Figure below Operation of a 2-input NAND gate.
A A
X X
B B
NAND Gate Truth Table
5
University of Anbar Subject / Digital TechniquesI
College of Engineering Second Stage / 1st Semester
Dept. of Electrical Engineering (2021 – 2022);lecture 3
ـــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ
Inputs Output
Logic Symbol
A B X
0 0 1 A
X
0 1 1 B
1 0 1
1 1 0
5- NOR Gate:
The NOR gate, like the NAND gate, is a very useful logic element because it
can also be used as a universal gate; that is; NOR gate can be used to perform the
AND, OR, and Inverter operations, or any combination of these operations.
Inputs Output
Logic Symbol
A B X
0 0 1 A
X
0 1 0 B
1 0 0
1 1 0
6
University of Anbar Subject / Digital TechniquesI
College of Engineering Second Stage / 1st Semester
Dept. of Electrical Engineering (2021 – 2022);lecture 3
ـــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ
A A
X X
B B
Inputs Output
Logic Symbol
A B X
0 0 0 A
X
0 1 1 B
1 0 1
1 1 0
7
University of Anbar Subject / Digital TechniquesI
College of Engineering Second Stage / 1st Semester
Dept. of Electrical Engineering (2021 – 2022);lecture 3
ـــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ
Inputs Output
Logic Symbol
A B X
0 0 1 A
X
0 1 0 B
1 0 0
1 1 1
8
University of Anbar Subject / Digital TechniquesI
College of Engineering Second Stage / 1st Semester
Dept. of Electrical Engineering (2021 – 2022);lecture 3
ـــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ
Example: (a) Develop the truth table for a 3-input AND gate.
(b) Determine the total number of possible input combinations for a
5-input AND gate.
For branch (a) there are eight possible input combinations for a 3-input AND gate.
Input Output
A B C X
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 0
1 0 0 0
1 0 1 0
1 1 0 0
1 1 1 1
For branch (b), N=25 =32. There are 32 possible combinations of input bits for a
5-input AND gate.
Example: for the two input waveforms, A and B, sketch the output waveform,
showing its proper relation to the inputs.
A A
B
B
X
X
When either or both inputs are HIGH, the output is HIGH as shown by the output
waveform X in the timing diagram.
9
University of Anbar Subject / Digital TechniquesI
College of Engineering Second Stage / 1st Semester
Dept. of Electrical Engineering (2021 – 2022);lecture 3
ـــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ
Example: Sketch the output waveform for the 3-input NOR gate, showing the
proper relation to the input.
A A
B
B C
X
X
The output X is LOW when any input is HIGH as shown by the output waveform
X in the timing diagram.
Example: For the 4-input NOR gate operating as a negative-AND. determine the
output relative to the inputs.
A A
B
C
B D
X X
10
University of Anbar Subject / Digital TechniquesI
College of Engineering Second Stage / 1st Semester
Dept. of Electrical Engineering (2021 – 2022);lecture 3
ـــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ
Summary of Logic Gates:
NOT A A NOR
A A+B A
X
B
OR A+B A EX-NOR A
X A B X
B B
NAND
A.B A
X
B
11