Escolar Documentos
Profissional Documentos
Cultura Documentos
FUNCTION OF
COMBINATIONAL LOGIC
CIRCUIT
OUTLINE
• HALF-ADDER ANF FULL ADDER CIRCUIT
• 4-BIT PARALLEL BINARY RIPPLE CARRY
ADDER
• 4-BIT PARALLEL BINARY CARRY LOOK-
AHEAD ADDER
• BCD ADDER CIRCUIT
• DECODER
• ENCODER
• MULTIPLEXER
• DEMULTIPLEXER
• CODE CONVERTER
• PARITY GENERATOR & CHECKER
In the previous chapter, we already look at how combinational circuit
operates. Now we will look at some specific function logic circuit.
An adder circuit will add up two 1-bit binary numbers and produces the
SUM and CARRY. The difference between half adder and full adder is
that a full adder has a CARRY IN input besides the two 1-bit binary
input. This adder circuit is a component in a computer ALU.
A half adder circuit will a 1-bit binary number (lets name it as „A‟) with 1-
bit binary number („B‟) and will produce 1-bit SUM and 1-bit CARRY
OUT ( C O for short) output. So, this circuit will have two input (a and b)
and two output (SUM and C o )
Figure 4.1
A
Block
Diagram of a SUM It‟s a good practice to start
half adder. FA
Co every design with a block
diagram get the whole
B picture of the system
1
From the truth table we get the expression for SUM and C o below.
SUM A B A B A B
Co A B
Figure 4.3
Circuit for a A
SUM
half adder
B
Co
Or
Figure 4.4
Circuit for a A
SUM
half adder B
(using X-OR) Co
For a full adder circuit, it has an extra 1-bit input C in . Therefore, the truth
table will have three 1-bit inputs and two 1-bit outputs.
Figure 4.4
Block A
diagram for a
full adder SUM
Cin FA
circuit Co
2
From the truth table, we get expression SUM and C o .
Figure 4.7 A
Full adder B SUM
circuit Cin
Co
3
Figure 4.8 A
Modified full B SUM Can you spot
adder circuit Cin the two half
adder in
figure 4.8?
Co
In a block diagram, a full adder build from two half adder are shown in
figure 4.9.
Figure 4.9
Modified full A A
adder circuit
SUM
HA HA
B Cin Co
In short, a 4-bit parallel binary ripple carry adder is a circuit that will add
up a 4-bit binary number (A4, A3, A2 and A1) with another 4-bit binary
adder (B0, B3, B2 and B1) and 1-bit CARRY IN ( C in ) that produce a 4-bit
SUM (0, 3, 2 and1) and 1-bit CARRY OUT ( C 4 ) output.
This circuit is actually comprises of four 1-bit adder (with the C in of the
LSB is grounded/disabled) or with three 1-bit full adder and one 1-bit
half adder (we don‟t need the C in anyway). The term ripple is to describe
the carry that „rippled‟ from one full adder to the next one.
4
Figure 4.11 A4 A3 A2 A1
Block C3
C4 C2 C1 Cin
diagram of a
4-bit parallel FA
(MSB)
FA FA FA
binary adder
using four 1- B4 B3 B2 B1
bit full adder
S3 S2 S1 S0
Example 4.1 If [A] = 01012 and [B] = 11012 are applied to a 4-bit parallel adder, what is
the resulting [] and C4?
REMEMBER
The „[ ] „ bracket is to indicate a
register. Therefore, [A] can be more
than 1-bit binary. We will see more
of this notation in register and
counter Chapter 6.
Figure 4.12
Solution for 0 1 0 1
example 4.1 1 1 0 1
Cin
FA
(MSB)
FA FA FA
1 1 0 1
Example 4.2 If [A] = 01012 and [B] = 0100 2 are applied to a 4-bit parallel adder, what is
the resulting [] and C4?
5
Figure 4.12
Solution for 0 1 0 1
example 4.1 0 1 0 0
Cin
FA
(MSB)
FA FA FA
0 1 0 0
Although a dedicated
subtractor circuit may
benefit in term of speed, but
it will also increase cost.
To change a binary number into its 2‟s complement form, first we need
to complement the entire bit and add „1‟. We can complement a binary
bit using a NOT gate. It‟s a simple solution, but we lose the „add‟
function of the adder. We need a means to control the operation of the
adder to „add‟ or „sub‟. This where the XOR gate comes in. Let‟s do
some examination on XOR gate first.
6
Figure 4.13 0
XOR gate 0 0 A B Z
characteristic 0 0 0 0
1 When A is 0, B = Z → not inverted
1 0 1 1
1 1 0 1
1 When A is 1, B = Z → inverted
0 1 1 0
1
1 0
From figure 4.13, we can use a XOR gate for inverting the bits, by
setting the control bit (A) a high (1), or not by setting A to low (0).
B3
B4
7
Figure 4.11 Vcc
IC 74LS283: (16)
4-bit parallel Vc
(5)
1
S
Σ2 1 16
adder pin c (3)
B2 2 15 B3 2
diagram (left) (14) A
A2 A3 3 (4)
and logic 3 14
(12)
1
symbol (right) Σ1 4 13 Σ3 4 (1)
2
74LS283 (6) S (13)
A1 5 12 A4 1 3
(2) (10)
B1 6 11 B4 2 4
(15) B
C0 7 10 Σ4 3
(11)
GND 8 9 C4 4
(7) (9)
Co C4
(8)
Gnd
(12)
Gnd
8
Figure 4.12 Vcc Vcc
Cascading (16) (16)
two unit of IC (5) (5)
A1 1 A5 1
74LS283 to (3) (3)
A2 2 A6 2
build an 8-bit (14) A (14) A
A3 3 (4) A7 3 (4)
adder 1 1 1 5
(12) (12)
A4 4 (1) A8 4 (1)
6
2 2 2
(6) (13)
B5
(6) (13)
B1 1 3 3 1 3 7
(2) (10) (2) (10)
B2 2 4 4 B6 2 4 8
(15) B (15) B
B3 3 B7 3
(11) (11)
B4 4 B8 4
(7) (9) (7) (9)
Co C4 Co C4 C8
Gnd Gnd
(8) (8)
9
Figure 4.13 STAGE 4 STAGE 3 STAGE 2 STAGE 1
4 stage adder
A4 A3 A2 A1
Cout4 Cout3 Cout2 C out1
FA
(MSB)
FA FA FA
Cin4 C in3 Cin2 Cin1
B4 B3 B2 B1
3 2 1 0
Cg4 A 4 B4 Cg3 A3 B3 Cg2 A 2 B2 Cg1 A1 B1
Cp4 A 4 B4 C p3 A 3 B3 C p2 A 2 B2 Cp1 A1 B1
from the equation Cout C g C p Cin the Cout for each stage is:
for stage 1:
C out1 C g1 C p1 Cin1
for stage 2
C out2 C g2 C p2 Cin2
and
therefore
C out2 C g2 C p2 (C g1 C p1 Cin1 )
C g2 C p2 C g1 C p2 C p1 Cin1
for stage 3
C out3 C g3 C p3 Cin3
and
10
therefore
C out3 C g3 C p3 (C g2 C p2 C g1 C p2 C p1 Cin1 )
C g3 C p3 C g2 C p3 C p2 C g1 C p3 C p2 C p1 Cin1
for stage 4
C out4 C g4 C p4 Cin4
and
therefore
C out4 C g4 C p4 (C g3 C p3 C g2 C p3 C p2 C g1 C p3 C p2 C p1 Cin1 )
C g4 C p4 C g3 C p4 C p3 C g2 C p4 C p3 C p2 C g1
C p4 C p3 C p2 C p1 C in1
Figure 4.14
Cin
4 stage carry
FA
A1
B1
look ahead
1
adder
Cin
FA
A1
B1
2
FA
A1
B1
3
FA
A1
B1
4
11
4.4 BCD ADDER
A 4-bit parallel adder can be used as a 1-digit BCD adder (1 BCD digit
uses 4-bit). Keep in mind that there is an illegal BCD code (1010 and
onwards). For a BCD addition, if the resulting code is larger than
decimal 9, a correction process must be done. The corrections are done
by adding a decimal 6.
So, we need two unit of 74LS283, one for the addition and the other for
the correction (adding 6). Besides that, we will also need a circuit to
detect whether correction need to be done or not. Detection is done
from the sum outputs of the addition IC.
So we have the C4, S4, S3, S2 and S1as the input for our detection circuit
(we will use notation S instead of because the output of the addition IC
is not final yet). Let‟s take a look at every condition that a correction
need to be done:
1. Whenever C4 is HIGH (1) (C4 are actually S5) →sum more than
decimal 15 or
2. Whenever both is S4 and S3 are HIGH (1) →sum more than
decimal 12 or
3. Whenever S4 and S2 are both HIGH (1) while S3 are LOW (0).
X C 4 S 4 S3 S 4 S3 S 2
C 4 S4 (S3 S3 S2 )
C 4 S4 (S3 S2 )
For adding the decimal 6, we will just use the X output from the
correction circuit and feed it into the correcting adder input B3 and B2
while the other input are grounded.
12
Figure 4.15 Vcc Vcc
4.5 DECODER
Figure 4.16
Decoder A0 O0
block diagram A1 O1
A2 O2
DECODER
An O2 n
INPUT OUTPUT
REMEMBER
For an decoder,
n
if there is n input, the circuit will have 2 output
13
Basic Binary Decoder
Figure 2.17 show a basic 2-bit decoder circuit and its truth table. From
the truth table, we can see that only one output is active (in this case
HIGH) at all time.
A 3-bit binary decoder has three input lines and eight output line. Figure
4.18 shows an active-LOW output decoder. Notice that the NAND gate
is used rather than AND to get an active-LOW output.
O0 A B C
O1 A B C
O2 A B C
O3 A B C
O4 A B C
O5 A B C
O6 A B C
O7 A B C
INPUT OUTPUT
A B C O0 O1 O2 O3 O4 O5 O6 O7
0 0 0 0 1 1 1 1 1 1 1
0 0 1 1 0 1 1 1 1 1 1
0 1 0 1 1 0 1 1 1 1 1
0 1 1 1 1 1 0 1 1 1 1
1 0 0 1 1 1 1 0 1 1 1
1 0 1 1 1 1 1 1 0 1 1
1 1 0 1 1 1 1 1 1 0 1
1 1 1 1 1 1 1 1 1 1 0
14
The most common decoder is a 4-bit decoder. It also known as a 4-line-
to-16-line decoder (because it has four input and 16 output) or a 1-of-16
decoder (because only one output for any given input combination).
Figure 4.19
BIN/DEC
Logic symbol 0
1
for a 4-line-to- 2
3
16-line (1-of- 1
2
4
5
16) decoder 4 6
7
8 8
9
10
11
12
13
14
15
(8)
A2
A1
A0
E1
E2
E3
07 06 05 04 03 02 01 00
15
To form a 1-for-32 decoder, four unit of this IC can be cascaded. The
EN will be used to select which IC will be active (remember that a
decoder can only have one active output at one time) from the A3 and
A4 input. We will also need an inverter.
A4 A3 A2 A1 A0
Figure 4.21
Four IC
74LS138 (15) (15) (15) (15)
0 8 16 24
cascaded to (1) (14) (1) (14) (1) (14) (1) (14)
1 1 1 9 1 17 1 25
form 1-for-32 (2) (13) (2) (13) (2) (13) (2) (13)
2 2 2 10 2 18 2 26
decoder (3) (12) (3) (12) (3) (12) (3) (12)
4 3 4 11 4 19 4 27
(11) (11) (11) (11)
4 12 20 28
(4) (10) (4) (10) (4) (10) (4) (10)
5 13 21 29
(9) (9) (9) (9)
(5) 6 (5) 14 (5) 22 (5) 30
& & & &
(7) (7) (7) (7)
+5V (6) 7 (6) 15 (6) 23 (6) 31
(12)
16
The purpose of having the two enable input is for cascading. As an
example, two unit of this IC can be cascaded to perform as a 1-for-32
decoder.
Figure 4.23
Two unit of IC Low order
(1)
High order
(1)
0 16
74HC154 (2) (2)
1 17
cascaded to 2
(3)
18
(3)
A0 1 (5) 1 (5)
32 decoder. (22)
4
(22)
20
A1 2 (6) 2 (6)
5 21
(21) (21)
A2 4 (7) 4 (7)
6 22
(20) (20)
A3 8 (8) 8 (8)
7 23
(9) (9)
8 24
(10) (10)
9 25
(11) (11)
10 26
(13) (13)
11 27
(14) (14)
12 28
(15) (15)
CS2 13 CS2 29
A4
(16) (16)
CS1
& 14 CS1 & 30
(17) (17)
15 31
A BCD-to-Decimal has four input lines and ten output lines. Thus, it‟s
called 4 line-to-10 line decoder or a 1-for-10 decoder. The operation is
like a 74HC154 (1-of-16 Decoder), but only has 10 output lines
(because BCD only has ten symbol). Figure 4.24 show the logic symbol
of this IC.
(8)
17
The 74LS47 BCD-to-7-Segment Decoder
(i) LT : Use for lamp test. When connected to LOW, all of the
segments are turned on.
(iii) BI / RBO : Can be used as either input or output. Used for zero
suppression. Zero suppression is to blank out the non essential
zero when using several 7-segment display to display a multi
digit numbers. There are two type of zero suppression:
a. Leading zero suppression (figure 4.26): for example take
number 20. If we are using 4 7-segment display (so it can
display up to 9999) without leading zero suppression, the
display will be 0020 (the non-essential zero didn‟t blank
out). In short, used for whole number.
b. Trailing zero suppression (figure 4.27): for example take
number .1400. If we are using 4 7-segment display (so it
can display up to .9999) without trailing zero suppression,
the display will be .14 (the non-essential zero didn‟t blank
out). In short, used for fractional number.
(6) (10)
symbol (right) D 6 11 c 8 d
(9)
A 7 10 d e
(3) (15)
GND 8 9 e LT f
(5) (14)
RBI GN g
D
(8)
18
(4) (4)
BI RBO BI RBO
(7) (13) (7) (13)
1 a 1 a
0 0 0 0
0 0 0 0
19
8 d 8 d
(9) (9)
e e
(3) LT (15) (3) LT (15)
f f
(5) RBI (14) (5) RBI (14)
g g
(4) (4)
BI RBO BI RBO
(7) (13) (7) (13)
1 a 1 a
0 0 1 0
0 0 0 0
1 0 0 0
0 0 0 1
(1) (12) (1) (12)
2 b 2 b
(2) (11) (2) (11)
4 c 4 c
(6) (10) (6) (10)
8 d 8 d
(9) (9)
e e
(3) LT (15) (3) LT (15)
f f
(5) RBI (14) (5) RBI (14)
g g
Figure 4.26
configuration
Figure 4.27
Zero leading
Zero trailing
configuration
for IC
for IC
74HC47
74HC47
4.6 ENCODER
Figure 4.28
Encoder A0 O0
block diagram A1 O1
A2 O2
ENCODER
A2 n
On
INPUT OUTPUT
Decimal-to-BCD Encoder
20
The 74HC147: Decimal-to-BCD Priority Encoder.
A normal encoder only can have one active input at a time. This is a
problem in a case where other inputs are accidentally active. This where
the advantage of the 74HC147. It is also called as 10 line-to-4 line
priority encoder. The word „priority‟ in the IC name is to describe its
ability to accept more than one active input at a time, but only the
highest input number are encoded. For example, if input 4 and 8 are
active, the output (because it is active LOW) will be 0111 2(810).
BCD OUTPUT
3 14
pin diagram D (13) (7)
D7 4 13 3 2 A1
(left), logic 74LS147
3 (1) (6)
D D 4 4 A2
symbol (right) 8
5 12
2 (2) (14)
D 5 8 A3
and truth A2 6 11
1
D (3)
table (bottom) A1 7 10
9
6
(4)
GND 8 9 A0 7
(5
8
(10)
9 GN
D
(8)
D1 D2 D3 D4 D5 D6 D7 D8 D9 A3 A2 A1 A0
1 1 1 1 1 1 1 1 1 1 1 1 1
X X X X X X X X 0 0 1 1 0
X X X X X X X 0 1 0 1 1 1
X X X X X X 0 1 1 1 0 0 0
X X X X X 0 1 1 1 1 0 0 1
X X X X 0 1 1 1 1 1 0 1 0
X X X 0 1 1 1 1 1 1 0 1 1
X X 0 1 1 1 1 1 1 1 1 0 0
X 0 1 1 1 1 1 1 1 1 1 0 1
0 1 1 1 1 1 1 1 1 1 1 1 0
21
The 74LS148: 8-line-to-3-line Encoder
This IC has eight active LOW input lines and three active LOW output
line. It also has three other pin for expanding purposes:
(8)
EI D0 D1 D2 D3 D4 D5 D6 D7 A2 A1 A0 GS EO
1 X X X X X X X X 1 1 1 1 1
0 1 1 1 1 1 1 1 1 1 1 1 1 0
0 X X X X X X X 0 0 0 0 0 1
0 X X X X X X 0 1 0 0 1 0 1
0 X X X X X 0 1 1 0 1 0 0 1
0 X X X X 0 1 1 1 0 1 1 0 1
0 X X X 0 1 1 1 1 1 0 0 0 1
0 X X 0 1 1 1 1 1 1 0 1 0 1
0 X 0 1 1 1 1 1 1 1 1 0 0 1
0 0 1 1 1 1 1 1 1 1 1 1 0 1
Similar to other IC‟s, two unit of this IC‟s can be cascaded to form a 16
line-to-4 line decoder with some external gates.
22
Figure 4.32
Cascading 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
two unit of IC
(10)
(11)
(12)
(13)
(10)
(11)
(12)
(13)
(5)
(1)
(2)
(3)
(5)
(1)
(2)
(3)
(4)
(4)
74HC148 to
EI 0 1 2 3 4 5 6 7 EI 0 1 2 3 4 5 6 7
form a 16
line-to-4 line
decoder
EO GS EO GS
4
(14)
(14)
(15)
(15)
(9)
(7)
(6)
(9)
(7)
(6)
A0 A1 A2 A3
4.7 MULTIPLEXER
Multiplexer (or MUX for short) is also called a data selector. We have
more than one „DATA‟ input that will be selected by using the „SELECT‟
to be passed through the MUX to the output line (only one output line
exists).
Figure 4.33
MUX
Multiplexer I0 A MUX operation is
block diagram similar to a Drink
I1
Vending Machine. We
I2
have a selection of
drinks that will be
Z
I3 dispense in a same
compartment.
In-1
DATA OUTPUT
INPUT
n
2
SELECT
23
A Basic 4 Input MUX
For a four input MUX, we need 2-bit select input (this will give us four
possible binary combination) to address which input to be selected and
then passed through to the output.
Figure 4.33
4 input
multiplexer I3
circuit (left) S1 S0 OUTPUT
and truth I2 0 0 Z = I0
table (right). 0 1 Z = I1
Z
I1 1 0 Z = I2
1 1 Z = I3
I0
S1 S0
This IC has eight active high input line for data, two outputs (one is
inverted), and three active high SELECT inputs to address the eight
data input. It also has another active low EN input for expanding
purposes.
(8)
24
Using an inverter and an OR gate, two unit of this IC can be cascaded to
form a 16 line-to-1 line MUX.
DATA INPUT
(1) (1)
I3 I3
(15) (15)
I4 (5) I4 (5)
(14) (14)
I5 I5
(13) (13)
I6 I6
(12) (12)
I7 I7
(7) (7)
EN EN
25
Figure 4.36: S2 S1 S0 VCC
Using MUX to
perform logic INPUT OUTPUT (4) Vcc (11)
function I0 S0 C
A B C Z
(3) (10)
0 0 0 0 I0 (GND) I1 S1 B
0 0 1 1 I1 (VCC) (2) (9)
I2 S2 A
0 1 0 1 I2 (VCC) (1)
0 1 1 1 I3 (VCC) I3
(15)
1 0 0 0 I4 (GND) I4 (5)
Z
1 0 1 1 I5 (VCC) (14)
I5 (6)
1 1 0 0 I6 (GND) Z
(13)
1 1 1 1 I7 (VCC) I6
(12)
I7
(7)
EN
4.8 DEMULTIPLEXER
Figure 4.37
DEMUX
Demultiplexer O0 A DEMUX operation is
block diagram like a paper sorter in a
O1 Photostat machine.
Each tray will has one
O2
complete copy of the
I
O3 document.
On-1
DATA
DATA IN OUTPUT
n
2
SELECT
26
The 74ALS138: 1 line-to- 8 line DEMUX
We have seen this IC in topic 4.5 (decoder). This IC can also perform as
a DEMUX. Remember that this IC has three inputs (A0, A1 and A2) that
can be use as SELECT and the eight outputs is already similar to a
DEMUX. But remember that DEMUX has one more input, that is the
„DATA IN‟. What left of the IC input pins are the three EN ( E1 , E2 and
E3). So, we can use either of this input for „DATA IN‟ but remember that
all the output is inverted. Therefore, it‟s more practical for using E1 or
E2 than E3 (because we need an extra inverter).
(8)
4.9 COMPARATOR
Comparator circuit, just like its name, will compare two binary numbers.
The simplest comparator will just detect equality (non equality) while a
more complex circuit can also determine which binary number is larger.
For bit equality/ non equality check, we can use XOR (or XNOR) gate.
Figure 4.39: 0 0
Revision on 0 0 1 1
XOR 1 1
operation 1 0 0 1
So, a 4-bit binary comparator (to detect equality only) can be build by
using four XOR gate and a AND gate.
27
Figure 4.40: A3 A2 A1 A0 1st Binary number
4-bit equality
comparator. If all the input bit
are equal, Z =‘0’;
Else, Z= ‘1'
This circuit will compare two 2-bit binary inputs A (A1, A0) with another
2-bit binary number B (B1, B0) and determine whether it is equal, and if
not, which one is greater. So this circuit will have four inputs and three
output.
Figure 4.41:
Block A1
diagram of a M = 1, if A=B
COMPARATOR
A0
N = 1, if A>B
magnitude
B1 P =1, if A<B
detector.
B0 *only one output can be
active at a time
28
Using three k-map (one for each output), we will get the expression for
M, N and P.
N A1 B1 A0 B1 B0 A1 A0 B0
P A1 B1 A0 B1 B0 A1 A0 B0 M N
Figure 4.43:
2-bit A1 A0 B1 B0
magnitude
detector
M
circuit
Figure 4.43:
A3
4-bit M
A2
magnitude N M = 1, if A=B
comparator B3 P
circuit using B2 N = 1, if A>B
two 2-bit
magnitude P =1, if A<B
comparator A1
A0 M
N
B1 P
B0
29
The 74HC85:4-bit Magnitude Comparator.
Comparator is also available in IC form. It has eight input line for the two
sets of 4-bit binary number (A3, A2, A1, A0, B3, B2, B1 and B0), and
another three inputs for cascading option.
(4) (5)
A<Bin A<Bout
symbol A=Bout 6 11 B1
(3) (6)
(right). A>Bout A=Bin A=Bout
7 10 A0
(2) (7)
GND 8 9 B0 A>Bin A>Bout
(1)
B3
(14)
B2
(11)
B1
(9) GN
B0
D
(8)
Figure 4.44
Lower-order comparator Higher-order comparator
2 unit of IC
(15) (15)
74LS85 A3 A7
cascaded to (13) (13)
A2 A6
form an 8-bit (12)
A1
(12)
A5
Magnitude +5V (10) (10)
A0 A4
Comparator (4) (5) (4) (5)
A<Bin A<Bout A<Bin A<Bout
(3) (6) (3) (6)
A=Bin A=Bout A=Bin A=Bout
(2) (7) (2) (7)
A>Bin A>Bout A>Bin A>Bout
(1) (1)
B3 B7
(14) (14)
B2 B6
(11) (11)
B1 B5
(9) (9)
B0 B4
30
4.10 CODE CONVERTER
BCD-to-Binary Conversion
This circuit wills covert a two digit BCD (from 0 to 99) into binary value. It
has eight input (each BCD consist of 4-bit) and seven output (7-bit is
sufficient to represent decimal 99).
(i) Find the binary number for each of the BCD digit value
(remember that each digit has a different weight). Let examine
a two digit BCD code.
1 0 1 0 0 0 0 2 1 0 1 0 0 0 0 2
0 1 0 1 0 0 0 2 0 1 0 1 0 0 0 2
0 0 1 0 1 0 0 2 0 0 1 0 1 0 0 2
0 0 0 1 0 1 0 2 0 0 0 1 0 1 0 2
(ii) Add up all the binary that represent every BCD digit.
For this purpose, we need two unit of 74LS283 (4-bit parallel binary
adder) because we have eight inputs. For interconnecting these IC,
let take a look at the binary number (this time in table form)
31
Figure 4.45 INPUT OUTPUT
BCD –to- BCD
binary BIT b6 b5 b4 b3 b2 b1 b0
conversion: D1 1 0 1 0 0 0 0
Step 2 C1 0 1 0 1 0 0 0
(Truth table) B1 0 0 1 0 1 0 0
A1 0 0 0 1 0 1 0
D0 0 0 0 1 0 0 0
C0 0 0 0 0 1 0 0
B0 0 0 0 0 0 1 0
A0 0 0 0 0 0 0 1
D1 C1 D1+ B1 C1+ A1+ B1+ C0 A1+ B0 A0
D0
Figure 4.46 D1 C1 B1 A1 D0 C0 B0 A0
BCD –to-
binary
(5)
conversion 1
(3)
circuit 2
(14) A
3 (4)
1
(12)
4 (1)
2
(6) S (13)
1 3
(2) (10)
2 4
(15) B
3
(11)
4
(7) (9)
Co C4
(5)
1
(3)
2
(14) A
3 (4)
1
(12)
4 (1)
2
(6) S (13)
1 3
(2) (10)
2 4
(15) B
3
(11)
4
(7)
Co b6 b5 b4 b3 b2 b1 b0
32
Binary-to-Gray Code Conversion
(i) Retain the MSB – simple, just connect to gray leftmost bit.
(ii) Add adjacent binary bit, discard carry – use XOR gate.
Figure 4.47 B0 G0
Binary –to-
gray code B1 G1
conversion
circuit B2 G2
B3 G3
B4 G4
(MSB)
Figure 4.48 G0 B0
Gray code –
to-Binary G1 B1
conversion
circuit G2 B2
G3 B3
G4 B4
(MSB)
33
4.11 PARITY BIT GENERATOR & CHECKER
Parity bits are determined by the numbers of „1‟s in the code (data
string) by summing up all the bits (discarding carry). If the result are:
„0‟ – the number of „1‟s are even
„1‟ – the number of „1‟s are odd
Figure 4.49
Even parity A6 A6
generator A5 A5
A4 A4
A3 A3
A2 A2
A1 A1
Even parity
Transmitted
Even parity generator Data
Figure 4.49
Odd parity A6 A6
generator A5 A5
A4 A4
A3 A3
A2 A2
A1 A1
Odd parity
Transmitted
Odd parity generator Data
To check the parity bit with the data (this is at the receiver), calculate
back the parity bit (same circuit as parity generator) and then whether
the result is the same with the parity bit received (done by using XNOR)
34
Figure 4.49
A6 A6
Even parity
A5 A5
checker
A4 A4
A3 A3
A2 A2
A1 A1
Even parity
Figure 4.49
A6 A6
Even parity
A5 A5
checker
A4 A4
A3 A3
A2 A2
A1 A1
Even parity
35
TUTORIAL
OBJECTIVE QUESTION
1. Which of the following input and output value are incorrect for the 4-bit parallel binary
adder/subtractor circuit in figure above?
(a) one data input, several data outputs (b) several data input, several data
and selection inputs output and selection inputs
(c) one data input, one data output and (d) several data input, one data output
one selection input and selection inputs
36
3. Table 3 is a truth table for a 2-to-4 line decoder priority encoder. Which of the inputs and
outputs combination is correct?
Table 3
Inputs Outputs
En A1 A0 D0 D1 D2 D3
(a) 0 x x 0 0 0 1
(b) 1 0 0 1 0 0 1
(c) 1 0 1 0 1 0 1
(d) 1 1 1 0 0 1 1
4. Table 4 is a truth table for a priority encoder. Which of the inputs and outputs combination
is incorrect?
Table 4
Inputs Outputs
D3 D2 D1 D0 A1 A0 Y
(a) 0 0 0 0 x x 0
(b) 0 0 0 1 0 0 1
(c) 0 0 1 x 0 1 1
(d) 1 x x x 1 0 1
5. A _____________ is a combinational circuit element that selects data from one of many
inputs and directs it to a single output.
37
6.
7.
If all the inputs are applied simultaneously to the ripple adder shown in Figure Q3, how
long does it take before the SUM and C4 become valid?
Assume that the delay of each gate (within each adder stage) is tp.
38
Figure 8
8. The full-adder in Figure 8 is tested under all input conditions with the input waveforms
shown. From your observation of the SUM and COUT waveforms, is it operating properly,
and if not, what is the most likely fault?
(a) Yes, the output SUM and COUT are (b) No, the input CIN is accidentally
correct. connected to VCC.
(c) No, the input B is accidentally (d) No, the input A is accidentally
connected to VCC. connected to VCC.
9 The following data input has been applied to the multiplexer in Figure 9a) : D0 0 , D1 1 ,
D2 1 and D3 0 . The data-select inputs to the multiplexer are sequenced as shown by
the waveforms in Figure 9(b), determine the output waveform.
(a)
(b)
(c)
(d)
39
10. To expand a 4 bit parallel adder to an 8 bit parallel adder you must
(a) use 4 bit adders with no connections (b) use two 4 bit adders and connect to the
sum outputs of one to the bit output of
the other
(c) use eight 4 bit adders with no (d) use two 4 bit adders with the carry
interconnections output of one connected to the carry
input of the other
11. If a 74LS85 magnitude comparator has A = 1011 and B = 1001 on the inputs, the outputs
are:
(c) A>B =1, A<B =1, A=B=0 (d) A>B=0, A< B=0, A=B=1
12. A BCD to 7 segment decoder has 0100 on the inputs. The active output segments are:
40
SUBJECTIVE QUESTION
This IC has eight active LOW input lines and three active LOW output line. It also has
three other pin for expanding purposes:
Show how two units of 74LS148 can be used as a 16-to-4 encoder. Please state the pin
number representing the D15 input (i.e. the most significant bit).
2. Design a circuit that behaves as a 3-to-8 decoder. Use only two types of logic gates, i.e.
NOT gates and AND gates.
F(A,B,C) = A BC AB
Figure 3
4. Match the names with the circuit diagram in Figure 4, leave blank if diagram isn’t there.
41
B
F
J C
D
E
d3 d2 d1 d0
D
SET
Q D
SET
Q D
SET
Q D
SET
Q
Out
Load
Clk
d3 d2 d1 d0
In D
SET
Q D
SET
Q D
SET
Q D
SET
Q
Clk I
H
G
Figure 4
5. A full adder can be implemented in many different ways. One of the method is by
combining two half adders. Beginning with the truth table, design the circuit that function
as a half adder, with the least number of gates. Then, design a full-adder circuit using the
two half-adders.
42
6. The logic diagram, truth table and logic symbol for an eight input multiplexer (74151) are
given in Figure 6. By using this eight input multiplexer, design a circuit that will perform a
16 bit parallel to serial conversion. Sketch the output waveform if the input to the
multiplexer is 1 1 0 0 0 1 1 1 1 0 1 0 1 1 0 1.
Figure 6
7. Consider a 4-bit parallel adder as shown in Figure 7. It is necessary to build a look ahead
carry circuit which generates the carry C3 to be fed to the full-adder of the most significant
bit position.
B3 B2 B1 B0
A3 A2 A1 A0
C3 C2 C1 C0
C4
S3 S2 S1 S0
Figure 7
43
8. Figure Q8 shows the logic symbol of the integrated circuit 74151: 3 line-to-8 line
multiplexer. Show in the given figure how this IC can be connected to perform the
following logic expression. Label completely and include this sheet in your answer script.
Z A B C
(16)
(8)
9. Prove (using Boolean theorem) that the circuit in figure 9 is equivalent to a full-adder.
A A
SUM
HA HA
B Cin Co
Figure 9
10. For the circuit in figure 10, determine the output if the input are:
A4 A3 A2 A1
C4 C3 C2 C1 Cin
FA
(MSB)
FA FA FA
B4 B3 B2 B1
S3 S2 S1 S0
Figure 10
a. [A] = 01112 and [B] = 11012
b. [A] =11012 and [B] = 10012
c. [A] = 00012 and [B] = 11112
44
11. For the circuit in figure 10, determine the input [A] if the output and input [B] are:
a. [B] = 01112 and [Σ] = 11012
b. [B] =11012 and [Σ] = 10012
c. [B] = 00012 and [Σ] = 11112
12. By using circuit in figure 12, determine and fill in the empty field in table 1 with the correct
answer (all numbers are unsigned)
4-bit binary number A
A4 A3 A2 A1
Adder/Subtractor
Control
Co
4-BIT PARALLEL BINARY ADDER
4 3 2 1 B1
B3
B4
Figure 12
7 0 0 1 0 0 9
0 1 0 1 0 3 1
1 0 0 0 8 0 0 1 0 2 1
4 0 1 0 0 1 9
0 0 1 1 0 0 0 0 0 0
13. By using circuit in figure 12, determine and fill in the empty field in table 1 with the correct
answer (all numbers are 4-bit signed). Comment on the result.
0 1 1 1 7 0 0 1 0 2 0
0 1 0 1 5 1 0 0 1 0 2
-8 0 0 1 0 2 1
0 1 0 0 4 0 1 0 0 1
0 0 1 1 3 0 0 0 0 0 0
45
14. Draw the complete connection for the two IC‟s (7483) in figure 14 to operate as an 8-bit
adder. Label all the inputs and outputs completely.
Vcc Vcc
(5) (5)
(10) (10)
1 1
(8) (8)
2 2
(3) A (3) A
3 (9) 3 (9)
1 1
(1) (1)
4 (6) 4 (6)
2 2
(11)
1 (2) (11) (2)
3 1 3
(7) (15) (7)
2 2 (15)
4 4
(4) B (4) B
3 3
(16) (16)
4 4
(13) (14) (13) (14)
Co C4 Co C4
(12) (12)
Gnd Gnd
Figure 14
15 For the circuit you build in figure 14, determine the output if the input are:
a. [A] =1101 01112 and [B] = 1101 11012
b. [A] =1011 11012 and [B] = 0011 10012
c. [A] =1001 00012 and [B] = 0101 11112
16. Design a 4-bit carry look-ahead adder. Start by deriving the Boolean equation for Cout and
the draw the complete circuit. What are the advantages and disadvantages of this circuit
compared with ripple carry adder?
17. What are the output of the decoder in figure 7 if the inputs are:
(16)
Vcc
0
(15) a. A0=0,A1=1,A2=1, E1 =0, E 2 =0 and E3 =0
(1) (14)
A0
(2)
1 1
(13)
b. A0=0,A0=1,A2=1, E1 =0, E 2 =0 and E3 =1
A1 2 2
A2
(3)
4 3
(12) c. A0=1,A1=1,A2=1, E1 =0, E 2 =1 and E3 =1
(11)
4
(10)
d. A0=1,A1=0,A2=1, E1 =0, E 2 =0 and E3 =0
(4)
E1 5
(9)
(5) 6
E2 &
(7)
(6) 7
E3 GND
(8)
Figure 17
18. Show how 4 units of ICs in figure 7 can be connected to perform as a 5 line-to-32 line
decoder.
46
19. What are the differences between a binary to BCD decoder with a 4 line-to-16 line
decoder?
20. Explain the „trailing zero suppression‟ and „leading zero suppression‟ configuration. When
these two configurations are used?
21. What are the advantages of using a priority encoder compared to a normal encoder?
D4 1 16 Vcc D1 D2 D3 D4 D5 D6 D7 D8 D9 A3 A2 A1 A0
D5 2 15 NC
D6 3 14 A3
1 1 1 1 1 1 1 1 1
D3
D7 4
74LS147
13
X X X X X X X X 0
D8 5 12 D2
X X X X X X X 0 1
A2 6 11 D1
X X X X X X 0 1 1
A1 7 10 D9
8 9 A0
X X X X X 0 1 1 1
X X X X 0 1 1 1 1
X X X 0 1 1 1 1 1
X X 0 1 1 1 1 1 1
Figure 22 X 0 1 1 1 1 1 1 1
0 1 1 1 1 1 1 1 1
23. Explain the characteristic of pin labeled EI, EO and GS in IC 74148. Shows how two units
of these ICs can be cascaded to perform as 16 line-to-4 line encoder.
24. Show how 4 unit of 74LS151 (MUX) can be cascaded to perform as a 32 line-to-1 line
MUX.
25. Show how 74LS151 (MUX) can be used to implement this logic circuit.
Z ABCD
26. Explain why in using 74138 ICs as a DEMUX, Data In is connected to the ACTIVE-LOW
enabled input instead of the ACTIVE-HIGH enable input?
27. Design a 2-bit magnitude relative detector that takes two 2-bit binary numbers; x1x0 and
y1y0, and determines whether they are equal and if not, which one is larger. There are
three outputs, defined as follows:
M=1 only if the two input numbers are equal
N=1 only if x1x0 is greater than y1y0
P=1 only if y1y0 is greater than x1x0
Start from truth table, then used Boolean theorem and/or karnaugh map to get the
simplified Boolean expression before drawing the circuit.
47
28. Show (in detail) how the circuit you design in question 27 can be used as a 4-bit
magnitude relative detector starting from the truth table.
29. Explain the design of BCD to binary code converter using your own understanding.
Figure 2 (a) show the logic symbol of 74LS138, 1-to-8 decoder. Waveform A0, A1, A2 and
E2 shown in Figure 2 (b) are applied to this decoder. Assume that E1 and E3 are tied to
A0
(15) A1
0
(1) (14)
A0 1 1 A2
(2) (13)
A1 2 2
(3) (12) E2
A2 4 3
(11)
4 O0
(4) (10)
E1 5
(9) O3
(5) 6
E2 &
(7)
(6) 7
E3 O6
O7
30. Given the circuit diagram of Figure 3(a), complete the timing diagram of Figure 3(b) for
QA, QB and QC.
48
31. Show how 74LS151 (MUX) below can be used to perform the following Boolean
expression.
Y (A B C) (A B C) (A B C) (A B C)
32. A decoder IC 74LS138 (3-to-8 decoder) shown in Figure Q3(d) can be used to implement
combinational logic function.
i) Implement GENAP circuit using this IC. GENAP circuit has four-bit binary inputs A
(A3A2A1A0). It has one output Z that will be HIGH (1) when A is an even numbers. Show
all steps.
ii) What are the modifications necessary so that this circuit will produce a HIGH (1) output
when the input is odd numbers?
4 (6)
circuit accordingly. (11) S
2
(2)
1 3
(7) (15)
2 4
(4) B
3
(16)
4
(13) (14)
Co C4
49
34. The 74LS148 is a 8 line-to-3 line encoder. This IC has eight active LOW input lines and
three active LOW output line. It also has three other pin for expanding purposes:
1 1 1 1 1 1 1 0 1
0 1 1 1 1 1 0 1 1
0 0 1 0 0 1 1 1 1
1 1 0 1 1 1 1 0 1
0 0 0 1 1 0 1 1 1
50
37. Figure below shows the logic symbol of a 2-bit relative magnitude detector. Show how two
unit of this circuit can be cascaded along with other logic gates to compare a 3-bit binary
numbers X2X1X0 and Y2Y1Y0.
A1
M = 1, if A=B
COMPARATOR
A0
N = 1, if A>B
B1 P =1, if A<B
38. Figure 2 (a) show the logic symbol of 74LS138, 1-to-8 decoder. Waveform A0, A1, A2 and
E3 shown in Figure 2 (b) are applied to this decoder. Assume that E1 and E 2 are tied to
LOW (0).
Draw the waveform for outputs O 0 , O 3 , O 6 and O 7
A0
(15)
0
A1
(1) (14)
A0 1 1
(2) (13)
A1 2 2
(12)
A2
(3)
A2 4 3
(11)
4
(10)
E3
(4)
E1 5
(9)
(5) 6
E2 & O0
(7)
(6) 7
E3
O3
O6
O7
51
39. Figure 3 show the logic symbol of 74LS151, 8-to-1 line multiplexer. Show how it can be
used to generate function Z A B C (A C) . Label completely.
(4) (11)
I0 S0
(3) (10)
I1 S1
(2) (9)
I2 S2
(1)
I3
(15)
I4 (5)
Z
(14)
I5 (6)
Z
(13)
I6
(12)
I7
(7)
EN
40. Show how one (1) unit of IC74LS151 can be use to implement the following function.
Z B ACD ACD
52
SUBJECT: ELECTRICAL ENGINEERING LABORATORY
BEE 2291 DIGITAL ELECTRONICS
A A
SUM
FA FA
B Cin Co
Figure 2
PRELAB TASK 1. By using Boolean theorem, show that a full-adder can be implemented by using two
half-adder shown in Figure 2.
2. By using the two half adder you constructed, build the circuit in Figure 2 on the
protoboard.
3. Connect the inputs (A, B and Cin) to the data switch and output (SUM and Co) to the
LED. Make sure every IC is connected to +5V and ground properly.
4. Build a truth table based on the output of this circuit by using all the possible input
combination.
SUM
Cin FA
Co
B
Figure 3
PRELAB TASK 1. Build truth table for a full-adder with input A, B and Cin, and output SUM and Co. This
will be the theoretical output.
2. Obtain the simplest Boolean expression for SUM and Co. Draw your circuit.
3. Re-draw your circuit complete with IC and pin numbers (refer datasheet for the IC pin
assignment).
53
LAB TASK 1. Construct the circuit on the protoboard.
2. Connect the inputs (A, B and Cin) to the data switch and output (SUM and Co) to the
LED. Make sure every IC is connected to +5V and ground properly.
3. Build a truth table based on the output of this circuit by using all the possible input
combination and verify that the results are similar with the theoretical full-adder truth
table.
4. Both circuit in experiment 6 and experiment 7 can perform as a full adder. In your
opinion, which design is better? Justify your answer.
(16)
Vcc (15)
0
(1) (14)
A 1 1
SELECT
(2) (13) S
B 2 2
(3) (12)
74138
Cin 4 3
(11)
+5V 4
(4) (10) Cout
5
(9)
(5) 6
&
(7)
(6) 7
GND
(8)
Figure 1
PRELAB TASK 1. By using any method you prefer, prove that a decoder with connection shown in figure 1
can be used as a full adder.
Hint: refer to the decoder datasheet.
2. Connect the inputs (A, B, and Cin) to the data switch and output (SUM and Cout) to the
LED. Make sure every IC is connected to +5V and ground properly.
3. Build a truth table based on the output of this circuit by using all the possible input
combination.
5. In your opinion, what is the advantages of this circuit compared with the full adder circuit
you built in experiment 4?
54
EXPERIMENT 9: Using a Multiplexer for Implement Logic Function
74151
(15)
I4 (5)
Z
(14)
I5 (6)
(13)
I6
(12)
I7
(7)
EN
Figure 1
PRELAB TASK 1. By using any method you prefer, prove that a multiplexer with connection shown in
figure 1 can be used to implement logic function below.
Z A B C
2. Connect the inputs (A, B, and C) to the data switch and output (Z) to the LED. Make
sure every IC is connected to +5V and ground properly.
3. Build a truth table based on the output of this circuit by using all the possible input
combination.
5. What necessary changes must be made if the circuit is now needed to implement the
following function?
Z A B C
BCD number A
Correction Circuit
Result in valid
BCD
55
PRELAB TASK 1. In your own words, explain how the circuit operates based on Figure 4.15 (refer to
teaching module).
2. Figure 4.15 shows a BCD adder circuit using 74LS283. This lab only has 74LS83.
Modify this circuit so it can be implemented using 74LS83. Refer to datasheet or
teaching module for the pin assignment.
2. Connect the inputs to the data switch and output to the LED. Make sure every IC is
connected to +5V and ground properly.
3. Verify that the circuit is functioning correctly by performing five (5) BCD addition
operations.
4. Based on this experiment, what are the disadvantages of using BCD code in a digital
circuit compared with binary?
56
CHAPTER 5
OUTLINE
• NAND LATCH
• NOR LATCH
• D LATCH
• EDGE TRIGGERED SC FLIP-FLOP
• EDGE TRIGGERED JK FLIP-FLOP
• EDGE TRIGGERED D FLIP-FLOP
• FLIP-FLOP CHARACTERISTIC
• FLIP-FLOP APPLICTION
57
Up until this chapter, we‟ve been only discussing about logic circuit
without any memory element. Without memory element, the logic circuit
cannot „remember‟ the previous output state and because of this, the
output will change (or re-evaluate) every time input changes.
A NAND latch is build from two NAND gate interconnected with the
other. It has two input, SET(S) and CLEAR(C), and two output Q and Q
(the inverted Q)
C Q
Now let‟s analyze this circuit. There are two inputs, so we have four
possible input combinations. Notice that the outputs are feed back into
the gate. Therefore we need to assume the initial value of Q for every
possible input combination. That gives us a total of eight possible
conditions.
Figure 5.2 1 1
NAND latch: S 1 S 1
Q Q
0
Case 1
1 0
0
C Q C Q
1 1
Before After
As we can see in figure 5.2, the output Q (after) is the same with Q
(before).
58
Case 2: S=1; C=1; Q=0
Figure 5.3 1 1
NAND latch: S 0 S 0
Q Q
1
Case 2
0 1
1
C Q C Q
1 1
Before After
As we can see in figure 5.3, the output Q (after) is the same with Q
(before).
Figure 5.4 1 1
NAND latch: S 0 S 0
Q Q
1
Case 3
0 1
1
C Q C Q
0 0
Before After
As we can see in figure 5.4, the output Q (after) is the same with Q
(before).
Figure 5.5 1 1 1
NAND latch: S 1 S 1 S 0
Q Q Q
1
Case 4
1 1 0 1
0
C Q C Q C Q
0 0 0
Before After
59
Case 5: S=0; C=1; Q=0
Figure 5.6 0 0 0
NAND latch: S 0 S 0 S 1
Q Q Q
1
Case 5
0 1 1 0
1
C Q C Q C Q
1 1 1
Before After
Figure 5.7 0 0
NAND latch: S 1 S 1
Q Q
0
Case 6
1 0
0
C Q C Q
1 1
Before After
As we can see in figure 5.7, the output Q (after) is the same with Q
(before).
Figure 5.8 0 0 0
NAND latch: S 0 S 0 S 1
Q Q Q
1
Case 7
0 1 1 1
1
C Q C Q C Q
0 0 0
Before After
As we can see in figure 5.8, the output Q (after) changes from 0 to 1 but
Q= Q . This output is not valid because the two outputs supposed to be
the invert of each other.
60
Case 8: S=0; C=0; Q=1
Figure 5.9 0 0
NAND latch: S 1 S 1
Q Q
1
Case 8
1 1
0
C Q C Q
0 0
Before After
As we can see in figure 5.9, the output Q (after) is the same but Q= Q .
This output is not valid because the two outputs supposed to be the
invert of each other.
From truth table in figure 5.11, it‟s clear that NAND latch uses active
LOW input for S (to SET) and C (to clear). Therefore, the input S=C=0
should not be used because we are trying to SET and RESET at the
same time. The logic symbol for this circuit are shown n figure 5.12
(notice the bubble at the input to indicates active LOW).
61
Figure 5.12
S Q
NAND latch
FF
C Q
Figure 5.13
NAND latch S
Q
(alternate
form)
C Q
Example 5.1 The waveforms in figure 5.14 are applied to a NAND latch. Assume that
initially Q=0, determine the Q waveform.
Figure 5.14
Waveform for S 1 0 1 1 1 1 0 0 1 1 1 1
example 5.1
C 1 1 1 1 1 1 1 1 1 0 1
Q 0 1 1 0 0 0 1 1 1 1 0 0
CLEAR
CLEAR
HOLD
HOLD
HOLD
HOLD
SET
SET
62
Figure 5.15 +5V Bouncing
Switching 1 +5V
Vout Switch comes
bounce (top) 2
0V
to rest in
position 2
and de- Switch to
bouncing position 2
using NAND
latch. +5V
1 Vout
S Q +5V
FF
0V
C
2
Switch to
+5V position 2
Just like a NAND latch, a NOR latch is build from two NOR gate
interconnected with the other. It has two inputs, SET(S) and CLEAR(C),
and two output Q and Q (the inverted Q).
Now let‟s analyze this circuit. There are two inputs, so we have four
possible input combinations. Notice that the outputs are feed back into
the gate. Therefore we need to assume the initial value of Q for every
possible input combination. That gives us a total of eight possible
conditions.
Figure 5.17 1 1
NOR latch: S 0 S 0
Q Q
0
Case 1
0 0
1
C Q C Q
1 1
Before After
As we can see in figure 5.17, this input combination is invalid because
the output Q is the same with Q .
Case 2: S=1; C=1; Q=0
63
Figure 5.18 1 1 1
NOR latch: S 1 S 1 S 0
Q Q Q
0 0
Case 2
1 0 0 0
0
C Q C Q C Q
1 1 1
Before After
Figure 5.19 1 1 1
NOR latch: S 1 S 0 S 0
Q Q Q
0 1
Case 3
0 0 0 1
C Q C Q C Q
0 0 0
Before After
Figure 5.20 1 1
NOR latch: S 0 S 0
Q Q
1
Case 4
0 1
1
C Q C Q
0 0
Before After
64
Figure 5.21 0 0
NOR latch: S 1 S 1
Q Q
0
Case 5
1 0
0
C Q C Q
1 1
Before After
Figure 5.22 0 0 0
NOR latch: S 0 S 0 S 1
Q Q Q
0
Case 6
0 0 1 0
1
C Q C Q C Q
1 1 1
Before After
Figure 5.23 0 0
NOR latch: S 1 S 1
Q Q
0
Case 7
1 0
0
C Q C Q
0 0
Before After
Figure 5.24 0 0
NAND latch: S 0 S 0
Q Q
1
Case 6
0 1
1
C Q C Q
0 0
Before After
As we can see in figure 5.24, the output Q remains the same.
As a result, a complete analysis are summarize in figure 5.25
65
Figure 5.25 Input Before After
Summarize S C Q Q Q Q
analysis
result of the 0 0 0 1 0 1 Q:00
HOLD
NOR latch 0 0 1 0 1 0 Q:11
0 1 0 1 0 1 Q:00
SET
0 1 1 0 0 1 Q:10
1 0 0 1 1 0 Q:01
CLEAR
1 0 1 0 1 0 Q:11
1 1 0 1 0 0 invalid
IGNORE
1 1 1 0 0 0 invalid
From truth table in figure 5.26, it‟s clear that NOR latch uses active
HIGH input for S (to SET) and C (to clear). Therefore, the input S=C=1
should not be used because we are trying to SET and RESET at the
same time. The logic symbol for this circuit are shown n figure 5.27.
Figure 5.27
S Q
NOR latch
FF
C Q
Figure 5.28
NOR latch S
Q
(alternate
form)
C Q
Example 5.2 The waveforms in figure 5.29 are applied to a NOR latch. Assume that
66
initially Q=0, determine the Q waveform.
Figure 5.29
Waveform for S 0 1 0 0 0 0 1 1 0 0 0 0
example 5.2
C 0 0 0 1 0 0 0 0 0 0 1 0
Q 0 1 1 0 0 0 1 1 1 1 0 0
CLEAR
CLEAR
HOLD
HOLD
HOLD
HOLD
SET
SET
An example application for a NOR latch is for a door alarm system
shown in figure 5.30. The door is connected to a switch that connects
the S input to the ground. When the door is open, the connection to
ground are open, and the S input are pulled-up to Vcc (1). Thus,
triggering the alarm. Alarm will continue to sound even when the door is
closed again, until the reset switch is pressed (assuming the door is
already closed).
Figure 5.30
+5V
NOR latch in
an alarm
S Q
system +5V
5.3 D LATCH
A D latch are also called a transparent latch because its ability to copy
the D input to its output Q. It has two input, D and EN (enable), and two
output, Q and Q .
Figure 5.31 D
D latch Q
EN
Q
The D latch will copy the input D waveform when the EN input is HIGH
67
(1) and will hold the present Q value when EN is LOW (0).
Example 5.3 Determine the output Q of a D latch when waveform D and EN shown in
figure 5.33 are applied. (Assume that initially Q=0).
Figure 5.33
Waveform for D
example 5.3 EN
The main difference between this and a latch is that the output level can
only be change during the transition of the clock input. This transition
may either be the positive-going-transition (PGT) or the negative-going-
transition (NGT) but not both.
Figure 5.34
The PGT and
NGT of clock CLOCK
signal.
PGT NGT
Therefore a SC FF has three input, SET (S), CLEAR (C) and CLOCK
(CLK) and two output, Q and Q .
68
Figure 5.35
S
SC FF Q
internal Edge
CLK detector
circuitry, PGT circuit
SC-FF Q
C
symbol
(bottom left)
and NGT SC-
S Q S Q
FF (bottom
right) CLK CLK
C Q C Q
The truth table for an SC-FF is shown in figure 5.36. It can be seen that
an edge triggered SC FF operate just like a NOR latch, but the transition
only happens at clock transition.
Let us examine when the same input waveform in figure 5.29 are
applied to an edge triggered SC FF.
Figure 5.35
S 0 1 0 0 0 0 1 1 0 0 0 0
SC FF (NGT)
waveform.
C 0 0 0 1 0 0 0 0 0 0 1 0
CLK
Q 0 1 1 0 0 0 0 1 1 1 1 1
0 1 1 0 0 0 1 1 1 1 0 0
Q (NOR LATCH)
69
Figure 5.36
S 0 1 0 0 0 0 1 1 0 0 0 0
SC FF (PGT)
waveform.
C 0 0 0 1 0 0 0 0 0 0 1 0
CLK
Q 0 0 0 0 0 0 1 1 1 1 0 0
0 1 1 0 0 0 1 1 1 1 0 0
Q (NOR LATCH)
Figure 5.37 Edge detection circuit (PGT) Edge detection circuit (NGT)
PGT edge
detection clock a c clock a c
circuit (left) b b
and NGT
edge Delayed due Delayed due
to inverter to inverter
detection a a
circuit (right). Spike Spike
b produced b produced
c c
70
5.5 EDGE TRIGGERED JK FLIP-FLOP (JK FF)
Figure 5.38
JK FF internal
J
circuitry, PGT Q
Edge
JK-FF symbol CLK detector
(bottom left) circuit
and NGT JK- K Q
FF (bottom
right)
J Q J Q
CLK CLK
K Q K Q
When inputs of JK FF are both high when it is triggered, it will invert the
previous output state (Q). This condition is called „toggle‟.
Figure 5.40
J 0 1 0 0 0 0 1 1 1 1 0 0
JK FF (NGT)
waveform.
K 0 0 0 1 1 0 0 1 1 1 1 0
CLK
Q 0 1 1 0 0 0 0 1 1 0 0 0
71
Figure 5.41
J 0 1 1 1 0 0 1 1 1 1 0 0
JK FF (PGT)
waveform.
K 0 0 0 1 1 0 0 1 1 1 1 0
CLK
Q 0 1 1 0 0 0 0 1 1 0 0 0
For any edge-triggered FF, the inputs (besides the clock) are called
synchronous input. This is because the output can only change state
when a clock transition occurs. Most FF in IC form also has a
asynchronous input labeled preset (PRE) and clear (CLR) that can
affect the state of the FF regardless of the clock. These two inputs are
both active-low (indicated by bubbles). Low input at PRE will set the FF
output to HIGH (1) and low input at CLR will reset the FF output to LOW
(0).
K Q K Q
CLR CLR
72
Figure 5.43 CLK
JK FF (PGT)
with J
asynchronous
inputs K
waveform.
PRE
CLR
TOGGLE
TOGGLE
TOGGLE
TOGGLE
TOGGLE
HOLD
HOLD
HOLD
HOLD
SET
SET
The 74112: Dual J-K Flip-Flop with Preset and Clear.
(8)
Gnd
73
5.6 EDGE TRIGGERED D FLIP-FLOP (D FF)
An edge triggered D FF only has one input, D (D=data) and clock for
edge triggering. When triggered, value of D will be transferred to output
(Q). This is useful for synchronizing especially in storing data (we can
control when data are to be stored).
Figure 5.46
Edge D Q D S Q D J Q
triggered
D-FF (PGT) CLK CLK CLK
Q C Q K Q
Q1 0 1 1 0 1 1 0 0 1 1 0
Q2 0 1 0 0 1 1 0 0 1 1 0
From figure 5.47, it can be seen that data that pass through a D FF a re-
synchronize by the clock input. This is important in data transmission
where data pulses are delayed, (or stretch) need to be re-synchronized.
The limitation is that the stretch pulse must not exceed one clock pulse.
74
5.7 FLIP-FLOP CHARACTERISTICS
Propagation delay
This is the time interval between the time when input are applied to the
time when output changes. It can be categorized into four types:
1. tPLH : time measured from the triggering edge of the clock pulse to
the LOW-to-HIGH transition of the output.
2. tPHL : time measured from the triggering edge of the clock pulse to
the HIGH-to-LOW transition of the output.
tPLH tPHL
3. tPLH : time measured from the leading edge of the PRESET input to
the LOW-to-HIGH transition of the output.
4. tPHL : time measured from the leading edge of the RESET input to
the HIGH-to-LOW transition of the output.
Pulse Widths
Minimum pulse width for the inputs and clock. Typically the clock is
specified by the minimum HIGH time and its minimum LOW time.
75
Set-up Time (ts)
Minimum time for the input to be at a constant level (ready) before the
triggering occurs.
CLK
50% of
triggering edge
76
5.8 FLIP-FLOP APPLICATION
We have look at several type of flip-flop. Now we will take a look at its
application. A single FF cannot do much, but when several FF are
connected together and with some other logic gates, it can be used for
many applications.
Frequency Divider
A frequency divider circuit will divide the clock with 2 for every stage. A
JK FF with its J and K input connected to HIGH (so it will always in
toggle mode) is required for each stage. Figure 5.52 shows a 4 stage
frequency divider.
Figure 5.52 1
A 4 stage
frequency J Q J Q J Q J Q
divider and
waveform CLK
(bottom) K K K K
QA QB QC QD
CLK
QA
QB
QC
QD
It can be seen from the waveform for each stage, the frequency are
halves. If the clock frequency are 10Hz:
QA=10/2=5Hz
QB=10/4=2.5Hz
QC=10/8=1.25Hz
QD=10/16=0.625Hz
77
Asynchronous Counter
Figure 5.53 1
MOD -16
counter and J Q J Q J Q J Q
waveform
(bottom) CLK
K K K K
QA QB QC QD
CLK
QA 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
QB 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1
QC 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1
QD 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0
(MSB)
DEC 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 1 2 3 4 5 6 7
From figure 5.53, it can be seen that a MOD-16 counter counts from
00002 (010) till 11112 (1510). It also consists of 4 JK FF (because
counting to 11112 (1510) require at least 4-bit with all the J and K input
connected to HIGH (JK FF always in toggle mode). The rule for
determining the minimum number of JK FF required is:
78
ONE-SHOT
Basic One-
Shot Device
Trigger
Q
The time for the device to stays in its unstable state are determine by
the capacitor and resistor value (RC time constant).
79
SUBJECT: ELECTRICAL ENGINEERING LABORATORY
BEE 2291 DIGITAL ELECTRONICS
PRELAB TASK 1. Draw a NAND latch circuit complete with IC and pin numbers (refer datasheet
for the IC pin assignment). Name this circuit as circuit 1.
2. Connect the inputs (SET and RESET) to the data switch and two outputs to the
LED. Make sure every IC is connected to +5V and ground properly.
PRELAB TASK 1. Draw a NOR latch circuit complete with IC and pin numbers (refer datasheet for
the IC pin assignment). Name this circuit as circuit 2.
2. Connect the inputs (SET and RESET) to the data switch and two outputs to the
LED. Make sure every IC is connected to +5V and ground properly.
PRELAB TASK 1. Draw a D latch circuit complete with IC and pin numbers (refer datasheet for the
IC pin assignment). Name this circuit as circuit 3.
2. Connect the inputs (D and EN) to the data switch and two outputs to the LED.
Make sure every IC is connected to +5V and ground properly.
80
EXPERIMENT 14: EDGE TRIGGERED SC FLIP FLOP
PRELAB TASK 1. Draw a SC Flip-flop circuit complete with IC and pin numbers (refer datasheet
for the IC pin assignment). Name this circuit as circuit 4.
2. Connect the inputs (S and C) to the data switch and CLK input to pulse
generator and two outputs to the LED. Make sure every IC is connected to +5V
and ground properly.
2. In your own words, write a short explanation about the asynchronous input of
this IC (the PRE and CLR input).
LAB TASK 1. Construct the circuit on the protoboard.
2. Connect the inputs (J, K, PRE and CLR ) to the data switch, and CLK input to
pulse generator and two outputs to the LED.
PRELAB TASK 1. Show (in drawings) how a JK flip-flop can be modified to operate as D flip-flop.
2. Re-draw this circuit complete with IC and pin numbers (refer datasheet for the
IC pin assignment).
LAB TASK 1. Connect the inputs, D the data switch, and CLK input to pulse generator and
two outputs to the LED.
81
CHAPTER 6
OUTLINE
• ASYNCHRONOUS COUNTER
• SYNCHRONOUS COUNTER
• STATE MACHINE
• SERIAL IN / SERIAL OUT SHIFT REGISTER
• SERIAL IN / PARALLEL OUT SHIFT REGISTER
• PARALLEL IN / SERIAL OUT SHIFT REGISTER
• PARALLEL IN / PARALLEL OUT SHIFT REGISTER
82
In chapter 5, we have discussed about the basic of counter. In this
chapter, we will go into the detail of counter, the types and IC available.
In the previous chapter, the counters we‟ve been discussing are only in
block diagram level. Now we are going to design and build a counter
using an IC.
For a MOD-8 counter, three JK FF are required. The block diagram and
expected waveform are shown in figure 6.1
Figure 6.1 1
MOD-8
Counter J Q J Q J Q REMEMBER
CLK J=K=1 for toggle
K K K operation
QA QB QC
CLK
QA 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
QB 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1
QC 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1
(MSB)
DEC 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
Therefore, the implementation using 74112 will require two unit of this IC
(because we need three JK FF while 74112 only contain 2 JK FF).
83
Figure 6.2 1
(4) (4)
Implementing
(3) PRE (5) (3) PRE (5)
a MOD-8 J Q
QA
J Q
REMEMBER
(1) (1)
counter using CLK
(2) (6) (2) (6) J=K=1 for toggle
74112 (15)
K
CLR
Q
(15)
K
CLR
Q
operation
PRE=CLR=1 for
(10) (10)
synchronous
(11) PRE (9) (11) PRE (9)
J Q J Q operation
(13) QB (13) QC
(12) (7) (12) (7)
K Q K Q
CLR CLR
(14)
Figure 6.3 1
(4) (4)
MOD -16
(3) PRE (5) (3) PRE (5)
counter J Q
QA
J Q
QD
REMEMBER
(1) (1)
CLK
(2) (6) (2) (6)
J=K=1 for toggle
K Q K Q
CLR CLR
operation
(15) (15)
PRE=CLR=1 for
(10) (10) synchronous
(11)
J
PRE
Q
(9) (11)
J
PRE
Q
(9) operation
(13) QB (13) QC
(12) (7) (12) (7)
K Q K Q
CLR CLR
(14) (14)
Up till now, we‟ve only discussing about counter with MOD number 2n
(e.g. MOD-8, MOD 16). To build a counter with MOD number other than
2n, other logic gates are needed for resetting the counter to 0. Let‟s take
a MOD-10 counter as an example.
84
reset/clear all the JK FF by sending a low signal to the CLR input. This
is done by using a NAND gate with the input connected to QD and QB
(because 10102 mean that QD and QB are equal to HIGH while QC and
QA are equal to LOW).
Figure 6.4 1
Block J
PRE
Q J
PRE
Q J
PRE
Q J
PRE
Q
diagram of a CLK
MOD-10
K K K K
counter CLR CLR CLR CLR
QA QB QC QD
CLK
QA 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
QB 0 0 1 1 0 0 1 1 0 0 0 0 1 1 0 0 1 1 0 0 0 0 1 1
QC 0 0 0 0 1 1 1 1 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0
QD 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0
(MSB)
DEC 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3
Glitch Glitch
1
(4) (4)
(10) (10)
85
The 74LS293: Decade Counter,4-bit Binary Counter
It can be seen that it‟s quite tedious to use 74112 IC for counter
implementation. As a better option, we have 4-bit binary counter IC
(74LS293). This decade counter is divided into two part, divide by eight
and divide by two. It is triggered by using NGT edge of clock pulse.
K K K K
CLR CLR CLR CLR
CP1
MR1
MR2 Q0 Q1 Q2 Q3
Note that the output of Q0 is not „hardwired‟ to the clock input of the next
JK FF. Therefore it needs to be connected externally. The purpose is to
add flexibility for this IC. The MR (master reset) is used for counter with
MOD number not equal to 2n (will reset all the JK FF when both are
input are HIGH).
86
Figure 6.6 (10) (8)
CLK CP0 Q4 QD(MSB)
MOD-11
(11) (4)
counter using CP1 Q2 QC REMEMBER
(5)
74LS293 Q1 QB Because there only
(12)
MR1
Q0
(9)
QA
two MR‟s, an
(13) & external AND gate
MR2
are used because
1110 (10112).
So we have look at few types of counter. But the entire counter we‟ve
seen so far is a count-up type. For a count-down type counter, the
connection is shown below.
Figure 6.8 1
MOD-8 Down J QA J QB J QC
Counter Notice how the
CLK
(right) and clock connection
K Q K Q K Q differs from a
waveform count-up counter.
(below).
CLK
QA 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
QB 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1
QC 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1
(MSB)
DEC 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6
Figure 6.9 1
MOD-16
Down counter J QA J QB J QC J QD
CLK
K Q K Q K Q K Q
87
6.2 SYNCHRONOUS COUNTER
The problem with asynchronous counter is that because the signal are
rippled from one FF to another, the delay for each FF are accumulated
(remember the case of a ripple carry adder).
88
Because of the AND operation, it‟s obvious that these counter requires
extra circuitry and the final circuit are shown in figure 6.11.
Figure 6.11
MOD-16 1
synchronous
counter J1 Q J2 Q J3 Q J4 Q
K1 K2 K3 K4
CLK
QA QB QC QD
For a synchronous counter with MOD number not equal with 2 n, we will
use the CLR input to reset the counter (same as the asynchronous
counter).
Figure 6.12
1
MOD-10
(decade)
J1 Q J2 Q J3 Q J4 Q
synchronous
counter
K1 K2 K3 K4
CLR CLR CLR CLR
CLK
QA QB QC QD
89
Figure 6.13 P0 P1 P2 P3
4-bit
Presetable
Synchronous
Counter 1
K1 K2 K3 K4
CLR CLR CLR CLR
CLK
PE
(Parallel
load)
QA QB QC QD
(4)
Q2
P1
with Parallel P0 3 14 Q0
(5) Q1
(13)
P2
Load P1 4 13 Q1
(6) Q0
(14)
74LS293 P3
P2 5 12 Q2
(2)
CP
P3 6 11 Q3
(7) CE (15)
CE P TC
7 10 CET (10)
P CET
(1)
GND 8 9 PE SR
(8)
Gnd
90
Synchronous Down/Up Counter
Figure 6.15
MOD-8 1 3
1 J1 QA J2 QB J1 QC
synchronous
up/down
counter K1 QA K2 QB K1 QC
2 4
UP/
DOWN
CLK
Vcc
Figure 6.16
(16)
74LS191: P1 1 16 Vcc (11)
PL (7)
Presetable (15)
Q3
Q1 2 15 P0 P0 (6)
4-bit (1)
P1
Q2
Q0 3 14 CP (2)
Up/Down (10)
P2
Q1
CE 4 13 RC (3)
Synchronous 74LS293
(9)
P3
Q0
U/D TC
Counter 5 12
(14)
CP
Q2 PL
pin diagram 6 11
(5)
U/D (15)
TC
(left) and logic Q3 7 10 P2 (4)
CE
symbol (right) GND 8 9 P3
(13)
RC
(8)
Gnd
91
5.3 STATE MACHINE
Designing a state machine follows steps below (you may skip certain
steps depending on the task):
1. State diagram: Diagram that shows all the transition of states when
clock are triggered. Amount of FF needed are also determine
depending on the bit.
2. Next state table: Table that listed all the present state along with its
next state.
3. Excitation table: Listed all the J and K connection for all FF for the
transition in next state table to occur. This is done by following the JK
FF transition table.
4. K-map: To determine the simplified logic expression for all the J and
K input.
92
Moore Machine
Figure 6.19
MOD-8 JA QA JB QB JC QC
synchronous FF A FF B FF C
up/down KA QA KB QB KC QC
counter
93
Step 3: Excitation table
FF C
J input K input
QA QA 0 1
QC∙QB 0 1 QC∙QB
00 0 0 QB QA 00 x x
JC QB QA
01 1 0 01 x x
QB QA K C QB QA
11 x x 11 0 0
10 x x 10 1 0
FF B
J input K input
QA QA 0 1
QC∙QB 0 1 QC∙QB
00 0 1 QC QA 00 x x
J B QC QA
01 x x 01 0 0
QC QA
K B QC QA
11 x x 11 0 1
10 0 0 10 x x
94
FF A
J input K input
QA QA 0 1
QC∙QB 0 1 QC∙QB
00 1 x QC QB 00 x 0 QC QB
J A QC QB
01 0 x 01 x 1
QC QB K A QC QB
11 1 x 11 x 0 QC QB
10 0 x 10 x 1
Figure 6.20
Gray code up
counter
JA QA JB QB JC QC
FF A FF B FF C
KA QA KB QB KC QC
CLK
Task 2: Design a 3-bit Moore state machine with state diagram shown in
figure 6.21.
011 101
111
001 010
95
Step 2: Next state table
PRESENT
STATE NEXT STATE FF C FF B FF A
QC QB QA Q C QB Q A JC KC JB KB J A KA
0 0 0 1 0 0 1 X 0 X 0 X
0 0 1 0 1 1 0 X 1 X X 0
0 1 0 0 0 1 0 X X 1 1 X
0 1 1 0 0 0 0 X X 1 X 1
1 0 0 1 0 1 X 0 0 X 1 X
1 0 1 0 1 0 X 1 1 X X 1
1 1 0 0 0 0 X 1 X 1 0 X
1 1 1 0 1 0 X 1 X 0 X 1
FF C
J input K input
QA QA 0 1
QC∙QB 0 1 QC∙QB
00 1 0 00 x x
QB QA JC QB QA
01 0 0 01 x x
QB K C QB QA
11 x x 11 1 1
10 x x 10 0 1 QA
96
FF B
J input K input
QA QA 0 1
QC∙QB 0 1 QC∙QB
00 0 1 QA 00 x x
J B QA
01 x x 01 1 1
QA QC K B QC Q A
11 x x 11 1 0
10 0 1 10 x x
FF A
J input K input
QA QA 0 1
QC∙QB 0 1 QC∙QB
00 0 x Q C Q B 00 x 0
J A QC QB
01 1 x 01 x 1
QC QB QB K A QB QC
11 0 x 11 x 1
QC
10 1 x 10 x 1
Figure 6.20
Gray code up
counter
JA QA JB QB JC QC
FF A FF B FF C
KA QA KB QB KC QC
CLK
97
Mealy Machine
Task: Design an up/down Gray code counter. If input Y is LOW (0), it will
count down, and if Y is HIGH (1), it will count up.
101 010
Y=0 Y=0
98
Step 4: K-map
FF C
J input K input
QA∙Y QA∙Y
QC∙QB 00 01 11 10 QC∙QB 00 01 11 10
00 1 0 0 0 00 x x x x
01 0 1 0 0 01 x x x x
11 x x x x 11 1 0 x 0
10 x x x x 10 0 1 0 0
J C Q A (Q B Y )
K C Q A (Q B Y)
FF B
J input K input
QA∙Y QA∙Y
QC∙QB 00 01 11 10 QC∙QB 00 01 11 10
00 0 0 1 0 00 x x x x
01 x x x x 01 0 0 0 1
11 x x x x 11 0 0 1 0
10 0 0 0 1 10 x x x x
J B Q A (Q C Y )
K C Q A (Q C Y )
FF A
J input K input
QA∙Y QA∙Y
QC∙QB 00 01 11 10 QC∙QB 00 01 11 10
00 0 1 x x 00 x x 0 1
01 1 0 x x 01 x x 1 0
11 0 1 x x 11 x x 0 1
10 1 0 0 x 10 x x 1 0
J A QC Q B Y
K A QC Q B Y
99
Figure 6.22 Y
Circuit For QA
QA
task 3 QB
QC
JC QC
FF C
KC QC
JB QB
FF B
KB QB
JA QA
FF A
KA QA
This register takes in serial data; shift it, the output data in serial format.
The shift operation may be a shift right, left or both (depending on the
design).
Figure 6.23
Basic Data Data in Data out
Movement of A register in a
a Shift Right microcomputer has
capabilities to do both
SISO (above)
type of shifting.
and Shift Left Data out Data in
SISO (below)
A basic 4-bit SISO register (right shift) comprises of four PGT edge-
triggered D FF. Data from input will move from input of the FF to the
input of the next one at every PGT. Therefore, it will take four clock
pulses for the data from DATA IN to get to the DATA OUT.
Figure 6.24
QA QB QC
A 4-bit Shift DATA IN D Q D Q D Q D Q DATA OUT
Right SISO
CLK
100
Let‟s examine the operation of the circuit in figure 6.24. A 4-bit data
(10112) are inserted serially (shift in/loading) in the DATA IN beginning
with the rightmost bit (LSB). Figure 6.25 shows what happen to the
inserted data after each clock pulse.
DATA IN
Figure 6.25 1 0 1 1
Initial condition, all FF output
Basic SISO 0 0 0 0
are cleared.
D Q D Q D Q D Q
operation FF A FF B FF C FF D
DATA OUT
(shift in)
CLK
DATA IN st
1 0 1 1
After the 1 clock pulse, the
LSB at the input D of FF A will
1 0 0 0
D Q D Q D Q D Q
DATA OUT be transferred to the Q of FF A
FF A FF B FF C FF D
CLK
DATA IN nd
1 0 1 1
After the 2 clock pulse, the
next bit at the input D of FF A
1 1 0 0
D Q D Q D Q D Q will be transferred to the Q of
DATA OUT
FF A FF B FF C FF D FF A and the LSB at that
already at the input of FF B will
CLK be transferred to Q of FF B
DATA IN rd
1 0 1 1
After the 3 clock pulse, the
next bit at the input D of FF A
0 1 1 0
D Q D Q D Q D Q will be transferred to the Q of
DATA OUT
FF A FF B FF C FF D FF A and the other bit are
shifted to the next FF
CLK
DATA IN th
1 0 1 1
After the 4 clock pulse, all the
data has been loaded into this
1 0 1 1
D Q D Q D Q D Q SISO register. Data can be
DATA OUT
FF A FF B FF C FF D stored until another clock pulse
received (or the power is off)
CLK
To get back the data stored, data are shifted out serially. This is
explained in figure 6.26.
101
th nd
DATA IN D Q
0
D Q
0
D Q
1
D Q
0
0 1 1
After the 6 clock pulse the 2
FF A FF B FF C FF D
DATA OUT 0 are transferred to Q of FF A
and by that, all the bit in the
CLK
other FF are shifted to the next
FF.
th
DATA IN D Q
0
D Q
0
D Q
0
D Q
1
1 0 1 1
After the 7 clock pulse all the
FF A FF B FF C FF D
DATA OUT data bit in the SISO register has
been outputted serially.
CLK
th
DATA IN D Q
0
D Q
0
D Q
0
D Q
0
DATA OUT
After the 8 clock pulse the
FF A FF B FF C FF D register has been clear (reset).
CLK
REMEMBER
Data in SRG 8 Q7
SRG 8 stands for
CLK Q7 Shift Register with
8-bit capacity
This register takes in serial data; shift it, and when done, output the data
in parallel.
Figure 6.27
Data in
Basic Data
Movement of
a SIPO
Data out
DATA OUT
Let‟s examine the operation of the circuit in figure 6.29. A 4-bit data
(10112) are inserted serially (shift in/loading) in the DATA IN beginning
with the rightmost bit (LSB). Figure 6.25 shows what happen to the
inserted data after each clock pulse.
102
DATA IN
Figure 6.29 1 0 1 1
Initial condition, all FF output
Basic SIPO are cleared.
D Q D Q D Q D Q
operation FF A FF B FF C FF D
CLK
0 0 0 0
DATA OUT
DATA IN st
1 0 1 1
After the 1 clock pulse, the
LSB at the input D of FF A will
1 0 0 0
D Q D Q D Q D Q be transferred to the Q of FF A
FF A FF B FF C FF D
CLK
1 0 0 0
DATA OUT
DATA IN nd
1 0 1 1
After the 2 clock pulse, the
next bit at the input D of FF A
1 1 0 0
D Q D Q D Q D Q will be transferred to the Q of
FF A FF B FF C FF D FF A and the LSB at that
already at the input of FF B will
CLK be transferred to Q of FF B
1 1 0 0
DATA OUT
DATA IN rd
1 0 1 1
After the 3 clock pulse, the
next bit at the input D of FF A
0 1 1 0
D Q D Q D Q D Q will be transferred to the Q of
FF A FF B FF C FF D FF A and the other bit are
shifted to the next FF
CLK
0 1 1 0
DATA OUT
DATA IN th
1 0 1 1
After the 4 clock pulse, all the
data has been loaded into this
1 0 1 1
D Q D Q D Q D Q SIPO register. Data can be
FF A FF B FF C FF D stored until another clock pulse
received (or the power is off)
CLK and can be retrieved
1 0 1 1 simultaneously (in parallel).
DATA OUT
Figure 6.30
Data in SRG 8
Logic symbol
for an 8-bit CLK
SIPO
Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0
103
The 74LS164: 8-bit Serial in / Parallel out Shift Register
This IC has two data input, A and B. Data is entered serially through
either A or B with the other function as enable/disable control or tied to
Vcc if unused. It also has asynchronous active low master reset (MR).
CP
MR
Q0 Q1 Q2 Q3 Q4 Q5 Q6 Q7
symbol (right)
104
edge.
Figure 4.22 DATA IN
4-bit Parallel D0 D1 D2 D3
D Q D Q D Q D Q
Q0 Q1 Q2 Q3
CLK
105
Figure 4.23 SHIFT / LOAD
(1)
(10)
The 74LS165: SHIFT / LOAD 1 16 Vcc
DS
CLK
(8) Examining from
8-bit PISO CLK 2 15 CLK INH
CLK INH
(9)
(3)
the internal
D4 3 14 D3 D0
Shift Register D5 4 13 D2
(4)
D1
Q7
(9)
circuitry:
pin diagram D6 5
74LS165
12 D1
(5)
D2 Q7
(7) (i) How to use
(6)
this IC as a
(left), logic D7 6 11 D0
(10)
D3
Q7 7 10 DS D4 SISO?
symbol (right) GND 8 9 Q7
(11)
D5
(12)
and internal (13) D
7
D6
circuitry
(bottom). D0 D1 D2 D3 D4 D5 D6 D7
SHIFT/
LOAD
DS D Q D Q D Q D Q D Q D Q D Q D Q Q7
CLK
CLK INH
A parallel in/ parallel out shift register takes all the DATA IN bit
simultaneously and after triggering edge, the data are available for
retrieval at the output line.
(bottom)
D Q D Q D Q D Q
CLK
Q0 Q1 Q2 Q3
DATA OUT
106
The 74HC195: 4-bit Parallel Shift Register
(1)
Q2
(12)
circuitry:
D0 4 13 Q2
pin diagram 74HC195 CLR Q3 (i) How to use the
D1 5 12 Q3
(4) (11)
J K input for
(left), logic D2 6 11 Q3
(5)
D0 Q3
circuitry
(bottom). SHIFT/ LOAD
J K D0 D1 D2 D3 CLR CLK
Q3
Q0 Q1 Q2 Q3
107
TUTORIAL
(a) Latch is a level sensitive device while (b) Latch is sensitive to glitches on
flip-flop is an edge sensitive device. enable pin, whereas flip-flop is
immune to glitches.
(c) Latches take less gates (also less (d) all above
power) to implement than flip-flops.
2. A bistable multivibrator is
(a) (b)
(c) (d)
(a) before the enable pulse (b) during the enable pulse
(c) immediately after the enable pulse (d) answers (b) and (c)
108
4. A JK flip-flop is presently in the SET state and must remain SET on the next clock pulse.
What is the input J and K?
5.
(a) When the input Y is changed. (b) When the clock value changes from
high to low.
7. For a finite state machine with 30 states, the number of storage elements (flip-flops)
needed to implement the sequential machine circuit is
(a) 30 (b) 15
(c) 5 (d) 4
8. In a clocked sequential circuit, the finite state machine can make a transition from one
state to another state:
(a) only once per clock cycle (b) only when it is in the initial state
109
9. Which of the following shows the connection for mod-6 counter using a decade counter?
(a) (b)
(c) (d)
10. The waveforms in Figure Q6 are applied to the inputs A & B of a flip-flop. Based on the
waveform of output Q, determine the type of flip-flop.
110
(a) Temporarily stored the data. (b) The operations are synchronous.
(c) The outputs respond to the present (d) The latches are bistable devices.
inputs.
12.
For a positive edge-triggered JK flip-flop with preset and clear inputs in figure above,
determine the Q output at clock pulse 6, 7 & 8.
13. A feature that distinguishes the JK flip-flop from the SC flip-flop is the
14. A JK flip-flop with J = 1 and K = 1 has a 5 kHz clock input. The output Q is
15. Asynchronous counters are also known as ripple counter. How many JK flip-flops are
needed to build MOD 32 counters?
111
(a) 4 (b) 6
(c) 5 (d) 7
16.
Indicate the type of the counter in Figure Q13. What would be the values of Q 2, Q1 and
Q0 when PL is low if P2, P1 and P0 are 0, 1 and 1 respectively?
17. Which of the following is NOT the characteristic of Moore state machine?
(a) Output signals can have asynchronous (b) Moore output is a function only of
changes the current flip-flop.
(c) Output signals are all synchronous. (d) Next states of Moore machine
depend solely on the present states.
18. A 10-bit ripple counter has a 256 kHz clock signal applied. Determine the frequency at
the MSB output and the MOD number of this counter.
112
(a) 250 Hz, 1024 (b) 250 Hz, 10
(a) clear the state (b) always cause the output to change
states
(c) set the flip-flop (d) cause the output to assume a state
dependent on the controlling (SC,JK,D)
inputs
(a) state changes can only occur at the (b) the state the flip-flop goes to depends
clock pulse edge on the D input
(c) the output follows the input at each (d) all of the above
clock pulse
113
(c) the number of states sequence (d) the modulus value
(a) 3 (b) 6
(c) 8 (d) 16
27. Complete the following table of flip-flop excitation values required to produce the
indicated flip-flop state changes, where X indicates the present state and Y is the
desired next state of the flip-flop.
Present Next State J-K Flip flop SC Flip flop D Flip flop
state
X Y J K S C D
0 0
0 1
1 0
1 1
28. Given the JK flip flop as shown in the Figure 28 below. Complete the timing diagram of
Figure 28 by determining the output waveform of Q.
Figure 28
29. The circuit of Figure 29contains a D latch, a positive edge-triggered D flip-flop, and a
negative edge-triggered D flip-flop. Complete the timing diagram of Figure 29 by drawing
the waveforms of the signals y1, y2 and y3.
114
Figure 29
30 (a) Draw the state transition diagram for a three bit counter that has the following
counting sequence: 0,1,2,4,6,7,3,5,0,1… repeats.
(c) If the counter is initially at 1012, what count will it hold after 3673 pulses?
31. A clock generator system's input frequency is 36 kHz. The system is required to
generate two frequencies 9 kHz and 3 kHz at its outputs. Propose an arrangement for
frequency division by using counters.
32. Design a state machine based on state diagram given in Figure 32 below by using
Moore machine. Assume state 0,3,4,6 as don‟t care. Implement the circuit by using JK
flip-flop.
001
111 010
101
Figure 32
33. Given the circuit diagram of Figure 33, complete the timing diagram of Figure 33 for Q A,
QB and QC.
115
Figure 33
34. Analyse the circuit diagram of Figure 34(a) and complete the timing diagram of Figure
34(b). Do not show the propagation delays. Draw the truth table of this circuit.
(a) (b)
35. Design and realise a 3-bit counter that counts in the following sequence:
…, 111, 010, 001, 110, 100, 000, 111, 010, 001, …
116
Use JK flip-flops in this design.
36. Complete the timing diagram for this circuit. The initial states of D flip-flops and input
waveforms are shown in Figure 36.
Figure 36
37. Table 37 is a state table for a circuit operation. Assume you make use of J-K flip flop in
the design. X is the external input and Z is the output of the circuit. Draw the logic
diagram for the sequential circuit
38. Explain one (1) advantage and one (1) disadvantages of a synchronous counter
compared with an asynchronous counter using suitable example or figure.
117
39. Figure below shows the block diagram of a digital clock. Show the connection for
counter A, B and C using IC 74LS293.
41. Figure below show the logic symbol of 74LS293, 4-bit binary counter. Show how it can
be used to generate a 10KHz clock from the 60KHz clock source. Label completely.
(10) (8)
Clock CP0 Q4
60KHz (11) (4)
CP1 Q2
(5)
Q1
(12)
MR1 (9)
Q0
(13) &
MR2
42. Eight sensors each feed eight bits of information to a circuit which processes the
information. It is decided that instead of using 64 signal lines, the data will be multiplexed
onto eight data lines with three address lines used to indicate the sensor using the data
lines. In fact, the sensors will be continually cycled through in order.
(i) A three-bit counter is required to cycle through the values for the address lines.
Design it using JK flip-flop. You may assume the availability of a clock signal.
(ii) An 8:1 multiplexer has eight data inputs, three control inputs and an output. The
value of the control inputs determines the data input which is selected as the
output. Design an 8:1 multiplexer.
(iii) Show how these components could be used to build the required system.
118
43. (a) A 4-bit shift register constructed from edge-triggered D-type flip flops is shown in
Figure Q6(a). If, on successive rising edges of the clock signal CLK, the input
takes on the values 1, 0, 1, 0, 1, 1, 1, 0, what are the contents of the shift register
after each edge of the clock? You may assume that the register contains all
zeroes initially.
(3 marks)
(b) The shift register in Q6(a) is require to detect „1011‟ bit pattern from the serial
data feed into the input pin. Design and illustrate how a combinational logic circuit
can be added to achieve this. This combinational logic circuit will produce an
output HIGH (1) when the pattern is detected.
(7 marks)
(c) Figure Q6(c) shows a state transition diagram for an infinite state machine with
control input, Y. Design the circuit using JK flip-flop.
(15 marks)
44. The circuit of Figure 3(a) contains a D latch, a positive edge-triggered D flip-flop, and a
negative edge-triggered D flip-flop. Complete the timing diagram of Figure 3(b) by
drawing the waveforms of the signals y1, y2 and y3.
119
45. Given the circuit diagram below, complete the timing diagram for QA, QB and QC.
Assume that QA, QB and QC are at high level initially.
46. Design a circuit that will generate TWO (2) frequencies, 12 kHz and 3 kHz at its outputs
when a clock signal applied to the circuit is operating at 48 kHz. Use JK flip-flops in your
design.
120
47. Determine and draw the state transition diagram for the Moore machine below.
‘0’ ‘1’
JA QA JB QB JC QC
FF A FF B FF C
‘1’ KA QA KB QB KC QC
CLK
121
SUBJECT: ELECTRICAL ENGINEERING LABORATORY
BEE 2291 DIGITAL ELECTRONICS
PRELAB TASK 1. Show (in drawings) how a four JK flip-flop can operate as a MOD-16 counter.
2. Re-draw this circuit complete with IC and pin numbers (refer datasheet for the
IC pin assignment). Name this circuit as circuit 1.
2. Connect all the outputs to LED and verify that the counter is functioning
correctly.
5. Write a brief discussion about the difference between a full modulus counter
and a truncated counter.
122
CHAPTER 7
DIGITAL SYSTEM
INTERFACING
OUTLINE
• DIGITAL-TO-ANALOG (DAC) CONVERSION
• DAC CIRCUITARY
• DAC PERFORMANCE
• DAC CONVERSION ERROR
• RECONSTRUCTION FILTER
• ANALOG-TO-DIGITAL (ADC) CONVERSION
• SAMPLE AND HOLD
123
In chapter 1, we have discussed about the overcoming the limitation of
digital system by using ADC (analog-to-digital converter) and DAC
(digital-to-analog converter). This chapter will discuss the detail about
interfacing a digital system with analog world.
Binary-Weighted-Input DAC
One method of DAC is by using resistor with different value for each bit.
The LSB has the largest value resister (lowest current) while the MSB
has the smallest value resistor (largest current) because each binary bit
has different weight.
The typical circuit is shown in figure 7.1. If there is voltage at the input
(input HIGH), there will be current across the resistor and this current
value varies between each input because of the different resistor value.
Because there is practically no current at the inverting input of the op-
amp (virtual ground), all the input current are summed together and the
drop across Rf is equal to the output voltage.
Figure 7.1 8R Rf
Typical D0 I0
Binary- 4R
Weighted- D1 -
I1 V0=IfRf
Input DAC 2R
+
Circuit D2 I2
R
D3 I3
The disadvantage of this type of DAC is the input level must be the
same and the amount of resistor needed in a higher bit input DAC. If
there is 8-bit input, the resistor must be in the range of R to 255R,
making this type of ADC very difficult to mass-produce.
Lets us examine circuit in figure 7.2. We are going to feed binary input
00002 (010) to 11112 (710) and calculate the corresponding output.
124
Figure 7.2 200 kΩ 10 kΩ
D0
Example I0
value of a D1
100 kΩ
-
Binary- I1 V0=IfRf
50 kΩ
+
Weighted- D2 I2
Input DAC 25 kΩ
Circuit D3 I3
For a +5 input (typical value for digital circuit) the current at each inputs
are:
5V
I0 0.025mA
200kΩ
5V
I1 0.05mA
100kΩ
5V
I2 0.1mA
50kΩ
5V
I3 0.2mA
25kΩ
Therefore,
Vout(D0) 10kΩ 0.025mA 0.25V
Vout(D1) 10kΩ 0.05mA 0.5V
Vout(D2) 10kΩ 0.1mA 1V
Vout(D3) 10kΩ 0.2mA 2V
Figure 7.3 shows the output voltage for each of the input combination.
0100
0101
1000
1001
1100
1101
1 1 0 0 -3.00
0010
0011
0110
0111
1010
1011
1110
1111
(binary)
1 1 0 1 -3.25
1 1 1 0 -3.50
1 1 1 1 -3.75
125
Notice that in the graph in figure 7.3, the analog output is not pure
analog signal (it look more like a step). In fact, a DAC output cannot
produce a pure analog signal (which varies continuously with time).
DAC Resolution
The different between each step in the graph in figure 7.3 is the
step size. It is defined as the smallest change that can occur in
the analog output corresponding to the input. So, for DAC in
figure 7.3, the step size is 0.25 V. The smaller the step size, the
„more analog‟ the output will be (because of the step is smaller).
So, the smaller the step size, the better DAC it is.
REMEMBER
Don‟t get confuse with „resolution‟ in
digital imaging. The resolution in
image is often referred to the amount
of pixel in a specific size image. Thus,
the higher resolution is, the better the
picture quality.
A fs where
resolution (step size) K
2n 1 Afs = analog full-scale output
n = the number of bits
126
Step size
% resolution (step size) 100%
A fs
Input Weight
Each of the bits in the binary input has different amount of contribution
to the output (weight). Taking DAC in figure 7.3 for example, the weight
for D3 is -2V, D2 is -1V, D1 is -0.5V and D0 is -0.25V. The MSB (D3) has
the most weight while LSB (D0) has the least.
We are going to take a look at several DAC circuit. The first one is the
„Binary-weighted-input DAC‟ which we already seen in figure 7.1. This
DAC consist of a resistor network to give every input a different weight
and then been connected to a summing op-amp.
One of the problems for this type of DAC is that Vout is dependent on the
digital input voltage. In the previous example, the weights of each bit are
calculated by assuming the input is 5V, which is the ideal case. To
overcome this, additional circuits are needed to provide a precise input
voltage.
127
Figure 7.3 Reference Supply
Binary- 8R
Weighted- D0 I0
Rf
Input DAC
Circuit With 4R
Reference D1 -
I1 V0=IfRf
Supply +
2R
D2
I2
R
D3 I3
This problem can be overcome by using R/2R Ladder DAC. It only uses
two resistor value, R and 2R. In this circuit, the MSB is D3.
Figure 7.3 D0 D1 D2 D3
The R/2R Rf = 2R
Ladder DAC R1 R3 R5 R7
2R 2R 2R 2R
R2 R4 R6 R8
- Vout
2R R R R +
Now let see this DAC in action. We will do an analysis for several input
condition.
Case 1: D3=1,D2=0,D1=0,D0=0
Figure 7.4 0 0 0 5V
The R/2R Rf = 2R
Ladder DAC R1 R3 R5 R7
2R 2R 2R 2R
with input
D=0001 R2 R4 R5 R7
- Vout
2R R R R +
128
the equivalent circuit will be:
Figure 7.5 5V
The R/2R Rf = 2R
R7
Ladder DAC 2R
with input
-
D=0001 REQ Vout
2R +
(equivalent
circuit)
therefore:
5V
Vout IR f 2R 5V
2R
Case 2: D3=0,D2=1,D1=0,D0=0
Figure 7.6 0 0 5V 0
The R/2R Rf = 2R
Ladder DAC R1 R3 R5 R7
2R 2R 2R 2R
with input
D=0010 R2 R4 R5 R7
- Vout
2R R R R +
Figure 7.7 5V
The R/2R Rf = 2R Rf = 2R
R5
Ladder DAC 2R VTH RTH R8
R8
with input R 2.5V R R
- -
D=0010 REQ Vout Vout
2R
R7
2R + R7
2R +
(equivalent
circuit)
therefore:
2.5V
Vout IR f 2R 2.5V
2R
129
Case 3: D3=0,D2=0,D1=1,D0=0
Figure 7.8 0 5V 0 0
The R/2R Rf = 2R
Ladder DAC R1 R3 R5 R7
2R 2R 2R 2R
with input
D=0100 R2 R4 R5 R7
- Vout
2R R R R +
Figure 7.9 5V
The R/2R Rf = 2R Rf = 2R
R3
Ladder DAC 2R
VTH RTH R8
R6 R8
with input R R 1.25V R R
- -
D=0100 REQ Vout Vout
2R
R5
2R
R7
2R + R7
2R +
(equivalent
circuit)
therefore:
1.25V
Vout IR f 2R 1.25V
2R
Case 4: D3=0,D2=0,D1=0,D0=1
Figure 7.10 5V 0 0 0
The R/2R Rf = 2R
Ladder DAC R1 R3 R5 R7
2R 2R 2R 2R
with input
D=1000 R2 R4 R5 R7
- Vout
2R R R R +
130
Figure 7.11 5V
The R/2R Rf = 2R Rf = 2R
R1
Ladder DAC 2R
R6
VTH R8
R4 R8
with input R R R 0.625V R
- -
D=1000 R2 Vout RTH Vout
2R
R3 R5
2R
R7
2R + R R7
2R +
(equivalent 2R
circuit)
therefore:
0.625V
Vout IR f 2R 0.625V
2R
Accuracy: the comparison of the actual DAC output with the expected
output.
131
7.4 DAC CONVERSION ERROR
132
Figure 7.14 Analog Output
DAC with
non-linearity High gain Ideal
15
error 14
13
12
11
10
2
Low gain
9
8
7
6
5
4
3
2
1
Binary
0
Input
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
Figure 7.15 Analog Output
DAC with
offset error Ideal
15
14
13
Offset
12
11
10
2
9
8
7
6
5
4
3
2
1
Binary
0
Input
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
133
7.5 RECONSTRUCTION FILTER
To get a more „analog‟ output, the staircase like DAC output are usually
feed into a reconstruction filter (a.k.a. post filter) to smoothen the output.
This is done by removing the higher frequency content of the signal by
using a low-pass filter. Figure 7,16 below shows the signal at the input
of this filter at the resulting output.
Re-
construction
filter input
(left) and
output (right).
t t
Figure 7.17
Basic 8-bit
Digital Ramp Analog
Clock
ADC block Input Comparator
diagram VA +
VA’
DAC Counter
Reset
Start
D7………………………………….D0
Binary (digital output)
134
This is how the ADC in figure 7.17 works.
Because of the conversion will not always stop at VA = VA‟ (can also
stop when VA < VA‟, we can say that the binary digital output is an
approximation of the analog input.
Because the counter in this ADC need to count until VA VA‟ before the
digital output can be obtain, this type of ADC is slow, especially if the
number of output bit increased and the time to finish vary depending on
the analog input.
Flash ADC
135
Figure 7.18
Basic 3-bit +VREF
Flash ADC.
Comparator
Analog
+
Input -
+
7
-
6
5
+
1
2
D0
Digital
4 Priority D1
-
3 Encoder 4 D2 Output
2
+
1
-
0
Before ADC conversion can be done, the analog value must hold still
until the conversion is done, which is impossible because analog signal
is a signal that varies over time. Therefore, to get a „still‟ signal, the
analog signal is „sampled‟ and then „hold‟ until the conversion complete.
Figure 7.19 below shows an original analog signal that are being
sampled by sampling pulse A and sampling pulse B (figure 7.20). Figure
7.21 shows the resulting sampled signal.
136
Figure 7.19
Original
Analog Signal Analog Input Analog Input
Figure 7.21
Sampled Sampled Signal
Signal Sampled Output
137
CHAPTER 8
INTEGRATED LOGIC
CIRCUIT FAMILY
OUTLINE
• INTEGRATED CIRCUIT (IC) BASIC
• IC CHARACTERISTIC AND PARAMETER
• MOSFETs
• TRANSISTOR-TRANSISTOR LOGIC (TTL)
• PROGRAMMABLE LOGIC DEVICE (PLD)
138
In this chapter, we will discuss the details of integrated circuit (or IC).
There are two type of IC, the fixed function (which function has already
been set by the manufacturer) and the programmable one. We will focus
on the fixed function IC and take a brief look at the programmable IC at
the end of this chapter.
The term integrated circuit (IC) is a small chip made of silicon that
contains the entire electronic circuit. This small chip are put inside a
„packaging‟ and connected to the package pin for I/O connection.
Figure 8.1
Cutaway view
of an IC
Packaging
Figure 8.2
PGA
Packaging
139
Figure 8.3
SOIC (small
outline IC), a
type of SMT
Figures below show the various type of SMT package and a short
explanation.
140
Figure 8.7 The land grid array (LGA) is a physical
P4-LGA775 interface for microprocessors of the Intel
Package IC Pentium 4 and AMD Opteron families.
(above) and Unlike the pin grid array (PGA) interface
socket found on most AMD and Intel
(below) processors, there are no pins on the
chip; in place of the pins are pads of
bare gold-plated copper that touch pins
on the motherboard.
IC Classification
By type:
o Integrated circuits can be classified into analog, digital and mixed
signal (both analog and digital on the same chip).
o Digital integrated circuits can contain anything from a few
thousand to millions of logic gates, flip-flops, multiplexers, and
other circuits in a few square millimeters. The small size of these
circuits allows high speed, low power dissipation, and reduced
manufacturing cost compared with board-level integration. These
digital ICs, typically microprocessors, DSPs, and micro
controllers work using binary mathematics to process "one" and
"zero" signals.
o Analog ICs, such as sensors, power management circuits, and
operational amplifiers, work by processing continuous signals.
They perform functions like amplification, active filtering,
demodulation, mixing, etc. Analog ICs ease the burden on circuit
designers by having expertly designed analog circuits available
instead of designing a difficult analog circuit from scratch.
o ICs can also combine analog and digital circuits on a single chip
to create functions such as A/D converters and D/A converters.
Such circuits offer smaller size and lower cost, but must carefully
account for signal interference
141
By transistor count:
o The first integrated circuits contained only a few transistors.
Called "Small-Scale Integration" (SSI), they used circuits
containing transistors numbering in the tens. SSI circuits were
crucial to early aerospace projects, and vice-versa. Both the
Minuteman missile and Apollo program needed lightweight digital
computers for their inertially-guided flight computers; the Apollo
guidance computer led and motivated the integrated-circuit
technology, while the Minuteman missile forced it into mass-
production. These programs purchased almost all of the
available integrated circuits from 1960 through 1963, and almost
alone provided the demand that funded the production
improvements to get the production costs from $1000/circuit (in
1960 dollars) to merely $25/circuit (in 1963 dollars). They began
to appear in consumer products at the turn of the decade, a
typical application being FM inter-carrier sound processing in
television receivers.
o The next step in the development of integrated circuits, taken in
the late 1960s, introduced devices which contained hundreds of
transistors on each chip, called "Medium-Scale Integration"
(MSI). They were attractive economically because while they
cost little more to produce than SSI devices, they allowed more
complex systems to be produced using smaller circuit boards,
less assembly work (because of fewer separate components),
and a number of other advantages.
o Further development, driven by the same economic factors, led
to "Large-Scale Integration" (LSI) in the mid 1970s, with tens of
thousands of transistors per chip. Integrated circuits such as 1K-
bit RAM, calculator chips, and the first microprocessors, that
began to be manufactured in moderate quantities in the early
1970s, had fewer than 4000 transistors. True LSI circuits,
approaching 10000 transistors, began to be produced around
1974, for computer main memories and second-generation
microprocessors.
o The final step in the development process, starting in the 1980s
and continuing on, was "Very Large-Scale Integration" (VLSI),
with hundreds of thousands of transistors, and beyond (well past
several million in the latest stages). For the first time it became
possible to fabricate a CPU on a single integrated circuit, to
create a microprocessor. In 1986 the first one megabit RAM
chips were introduced, which contained more than one million
transistors. Microprocessor chips produced in 1994 contained
more than three million transistors. This step was largely made
possible by the codification of "design rules" for the CMOS
technology used in VLSI chips, which made production of
working devices much more of a systematic endeavor.
142
o To reflect further growth of the complexity, the term ULSI that
stands for "Ultra-Large Scale Integration" was proposed for
chips of complexity more than 1 million of transistors. However,
there is no qualitative leap between VLSI and ULSI, hence
normally in technical texts the "VLSI" term covers ULSI as well,
and "ULSI" is reserved only for cases when it is necessary to
emphasize the chip complexity, e.g. in marketing.
Technology
DC Supply Voltage
143
Logic Level
Figure 8.8 5V 5V
HIGH (1) VOH
Typical 4.4V VOH(min)
VIH
parameter for HIGH (1)
a 5V CMOS VIH(min)
3.3V
IC
Undefined Undefined
1.5V VIL(max)
0.8V VIL(max)
LOW (0) VIL 0.4V VOL(max)
LOW (0) VOL
0V 0V
144
Figure 8.10 5V 5V
Typical
parameter for
a 5V TTL IC HIGH (1) VOH
HIGH (1) VIH
2.4V VOH(min)
2V VIH(min)
Undefined Undefined
0.8V VIL(max)
LOW (0) VIL 0.4V VOL(max)
LOW (0) VOL
0V 0V
Noise Immunity
Noise Margin
Circuit noise immunity are called noise margin, and measured in volt.
There are two parameter for noise immunity:
Power Dissipation
Logic gate will drawn current from the DC supply voltage. There are two
type of current:
145
Therefore, the power dissipation for a gate with HIGH (1) output is:
PD VCC I CCH
When the gate is pulsed, with 50% duty cycle, the output will be 50% in
HIGH (1) states and 50% in LOW (0) states. Therefore, the average
supply current is:
I CCH I CCL
I CC
2
PD(ave) VCC I CC
Propagation Delay
When signal passed through a gate, time delay will occurs. There are
two types of time delay, tPHL and tPLH. (refer to chapter 5 in subtopic Flip-
flop characteristic).
As the name implies, it is the product of power and time. This parameter
are used when both speed and power are critical aspect in selecting
types of IC for a design. The lower the speed power product value is
better.
146
Figure 8.11 + 5V
Capacitive
HIGH LOW
loading of
IDISCHARGE
CMOS gate ICHARGE
Charging Discharging
TTL Loading: A TTL driving gate source current to load gate input in
HIGH (1) state and sinks current from the load gate in LOW (0) state.
Figure 8.12 + 5V + 5V
Current
1 HIGH 0 LOW
sourcing and
sinking of TTL 1 IIH IIL
gate
Current Sourcing Current Sinking
As more load added, the total source current will increase, and the
internal voltage drop of the driving gate will also increase. This will
decrease the output voltage. If the output voltage drop below the
VOH(min), the noise margin are reduce, thus compromising the circuit
operation. Increasing load will also increase the power dissipation in the
driving gate. The maximum number of load is called a unit load.
As more load added, the total sinking current will increase, and the
internal voltage drop of the driving gate will also increase. This will
increase the VOL and if it exceeds the VOL(max), the noise margin are
reduce, thus compromising the circuit operation.
147
8.3 MOSFETs
A variety of symbols are used for the MOSFET. The basic design is
generally a line for the channel with the source and drain leaving it at
right angles and then bending back into the same direction as the
channel. Sometimes a broken line is used for enhancement mode and a
solid one for depletion mode, but the awkwardness of drawing broken
lines means this distinction is often ignored. Another line is drawn
parallel to the channel for the gate.
Figure 8.13
NMOS and
PMOS
symbol
148
n-Channel MOSFET transistors
With no voltage between the gate terminal and the substrate, there are two
junctions between the two n regions and the p region.
This acts like two oppositely connected diodes, and no current can flow
between the source and the drain.
Application of a positive voltage between the gate terminal and the
substrate creates an electric field that drives
Holes out of the region under the gate, creating a channel of n-type material
that connects the source and drain terminals.
Current is due to electron movement
Tap analogy
Sub-threshold, linear, and saturation regions of operation
Standard notation that you will encounter includes supply voltage VDD,
gate-to-source voltage VGS, drain-to-source voltage VDS, and threshold
voltage VT
Figure 8.14
NMOS
structure and
operation
Figure 8.15
PMOS
structure
149
The general model for implementation of gates hinges on the use of
passive versus active pull-up
Figure 8.16
Pull-up and
Pull-down
network
general
model
Figure 8.17
Active and
passive Pull-
up network
general
model
150
nMOS and CMOS logic families
Figure 8.18
NMOS logic
family
Figure 8.19
CMOS logic
family
No current flows through the gate unless the input signal is changing
High input impedance
High fanout
Sandwich structure of MOS transistor creates capacitor between the
gate and substrate
High input capacitance that slows transition time (switching speed)
and limits fan-out
nMOS dissipates power in low output state
The faster a CMOS gate switches the more power it dissipates, so
there is a tradeoff between
CMOS gate only dissipates power when it is changing state
151
8.4 TRANSISTOR-TRANSISTOR-LOGIC (TTL)
Like most integrated circuits of the period 1960-1990, TTL devices are
usually packaged in through-hole, dual in-line packages with between
14 and 24 lead wires, made usually of epoxy plastic but also commonly
ceramic. Other packages included the flat-pack, used for military and
aerospace applications, and beam-lead chips without packages for
assembly into larger arrays. As surface-mounted devices became more
common through the 1990's, most popular TTL devices were made
available in these packages.
152
Figure 8.20 +5V
Standard TTL
inverter circuit R1 R2 R3
4kΩ 1.6kΩ 130Ω
Q4
INPUT Q2 D2
Q1
OUTPUT
D1 Q3
R4
1kΩ
The two figures below shows the operation of this TTL inverter.
153
Figure 8.23 +5V
TTL NAND
gate R1 R2 R3
Q4
A Q1 Q2
B OUT
Q3
R4
Before PLDs were invented, read-only memory (ROM) chips were used
to create arbitrary combinatorial logic functions of a number of inputs.
Consider a ROM with m inputs (the address lines) and n outputs (the
data lines). When used as a memory, the ROM contains 2m words of n
bits each. Now imagine that the inputs are driven not by an m-bit
address, but by m independent logic signals. Theoretically, there are 2m
possible Boolean functions of these m signals, but the structure of the
ROM allows just n of these functions to be produced at the output pins.
The ROM therefore becomes equivalent to n separate logic circuits,
each of which generates a chosen function of the m inputs.
154
they consume more power, and
because only a small fraction of their capacity is used in any one
application, they often make an inefficient use of space.
Stand alone they cannot be used for sequential logic, because they
contain no flip-flops. An external TTL register was often used for
sequential designs such as state machines.
Common EPROMs, for example the 2716, are still sometimes used in
this way by hobby circuit designers, who often have some lying around.
This use is sometimes called a 'poor man's PAL'.
155
PAL: Programmable Array Logic
After MMI succeeded with the 20-pin PAL parts, AMD introduced the 24-
pin 22V10 PAL with additional features. After buying out MMI (1987),
AMD spun off a consolidated operation as Vantis, and that business was
acquired by Lattice Semiconductor in 1999.
An innovation of the PAL was the generic array logic device, or GAL,
invented by Lattice Semiconductor in 1985. This device has the same
logical properties as the PAL but can be erased and reprogrammed. The
GAL is very useful in the prototyping stage of a design, when any bugs
in the logic can be corrected by reprogramming. GALs are programmed
and reprogrammed using a PAL programmer, or by using the in-circuit
programming technique on supporting chips.
PALs and GALs are available only in small sizes, equivalent to a few
hundred logic gates. For bigger logic circuits, complex PLDs or CPLDs
can be used. These contain the equivalent of several PALs linked by
programmable interconnections, all in one integrated circuit. CPLDs can
replace thousands, or even hundreds of thousands, of logic gates.
156
computer. The CPLD contains a circuit that decodes the data stream
and configures the CPLD to perform its specified logic function.
While PALs were busy developing into GALs and CPLDs (all discussed
above), a separate stream of development was happening. This type of
device is based on gate-array technology and is called the field-
programmable gate array (FPGA). Early examples of FPGAs are the
82s100 array, and 82S105 sequencer, by Signetics, introduced in the
late 1970s. The 82S100 was an array of AND terms. The 82S105 also
had Flip Flop functions.
FPGAs use a grid of logic gates, similar to that of an ordinary gate array,
but the programming is done by the customer, not by the manufacturer.
The term "field-programmable" may be obscure to some, but "field" is
just an engineering term for the world outside the factory, where
customers live.
FPGAs are usually programmed after being soldered down to the circuit
board, in a manner similar to that of larger CPLDs. In most larger
FPGAs the configuration is volatile, and must be re-loaded into the
device whenever power is applied or different functionality is required.
Configuration is typically stored in a configuration PROM or EEPROM.
EEPROM versions may be in-system programmable (typically via
JTAG).
FPGAs and CPLDs are often equally good choices for a particular task.
Sometimes the decision is more an economic one than a technical one,
or may depend on the engineer's personal preference or experience.
157
Program in PLD
158
PALASM and ABEL are frequently used for low-complexity devices,
while Verilog and VHDL are popular higher-level description languages
for more complex devices.
The more limited ABEL is often used for historical reasons, but for new
designs VHDL is more popular, even for low-complexity designs.
159