Sunteți pe pagina 1din 168

ENG 237 Basic Elasticity and Electronics

Subject lecturer: Dr. Zhao XU


Department of Electrical Engineering
Hong Kong Polytechnic University
Email: eezhaoxu@polyu.edu.hk
Room: CF632
Tel: 27666160

ENG237 Basic Electricity & Electronics I

Digital Logic Circuits- Outline


1. Number
1
N b S
Systems
t
2. Combinational Logic
g Circuits
3. Sequential Circuits

ENG237 Basic Electricity & Electronics I

Number Systems
A number system is a way of counting
things. It's a way of identifying the quantity
of something.
Number systems of a given radix or base
provide the means of quantifying
information for processing by digital
systems e.g.
systems,
e g the radix or base of decimal
number is 10 and binary numbers is 2.
3

ENG237 Basic Electricity & Electronics I

Position Number Systems


Number systems use position notation to
represent value.
value
The position of the characters indicates value as
well as the character itself.
For example
example, the decimal system has 10 characters
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9) to represent value. For
values greater than 99, they are indicated by
position, e.g. 11.
4

ENG237 Basic Electricity & Electronics I

Decimal Numbers
The decimal number is expressed as:
DN 1 DN 2 DN 3 D1 D0
where N is the no. of digits
General rule:
DN 110 N 1 + DN 2 10 N 2 + DN 310 N 3 + +D110 + D0
Examples:
1 536 = 5 10 2 + 3 101 + 6 10 0 = 536
1.
2. 3192 = 3 10 3 + 1 10 2 + 9 101 + 2 10 0 = 3192

ENG237 Basic Electricity & Electronics I

General Description of Number Systems


For a number system with
d: the digital of the number
r: the radix or the base of the number system, e.g. the radix or base is
10 in a decimal system,
y
, and 0 - 9 can appear
pp in each digit
g position
p
n: the number of digits in the number
V: the value

V = dn 1r n 1 + dn 2 r n 2 + L + d1r + d0
Value of a number is absolute, but a particular value can be represented
in different number systems.

ENG237 Basic Electricity & Electronics I

Binary System and Binary-to-Decimal


Conversion
For an n-bit binary number B,

B = bn 1bn 2 bn 3 L b1b0 ,
The value of B can be evaluated by the general formula,
formula

V = dn 1r n 1 + dn 2 r n 2 + L + d1r + d0
Example:
10112 = 1 2 3 + 0 2 2 + 1 21 + 1
= (8 + 0 + 2 + 1)10
= 1110
7

ENG237 Basic Electricity & Electronics I

Decimal-to-Binary Conversion
Convert the decimal number 1410 to a binary number.
14 2 = 7
72=3

Remainder
0 = b0
1 = b1

3 2 =1
1 2 = 0

1 = b2
1 = b3

b3b2b1b0 = 1110 2

ENG237 Basic Electricity & Electronics I

Fractional Binary Number

14.5610=?
9

ENG237 Basic Electricity & Electronics I

Octal and Hexadecimal Number Systems

10

ENG237 Basic Electricity & Electronics I

Hexadecimal Digits

11

ENG237 Basic Electricity & Electronics I

Binary Octal Hexadecimal


Conversions

12

ENG237 Basic Electricity & Electronics I

Binary Arithmetic

13

ENG237 Basic Electricity & Electronics I

Signed Numbers
Signed numbers provide the means by which both positive
andd negative
ti numbers
b may be
b represented.
t d
Three main
Th
i signed
i d numbers:
b
1. Signed magnitude
2 True
2.
T
(radix)
( di ) complement
l
3. Radix-minus-1 complement

14

ENG237 Basic Electricity & Electronics I

Signed Magnitude Codes


The most significant bit position is 0 for all positive values and 1 for
negative values.

Examples:
Decimal

Signed
g
magnitude
g

+15

01111

+10

01010

+0

00000

-0

10000

-10

11010

-15

11111

sign
15

ENG237 Basic Electricity & Electronics I

Complements in Number Systems


Two types:
1. True complement (Radix complement)
Formed by subtracting each digit of the number
f
from
the
h radix-minus-one
di
i
(R 1) off the
(R-1)
h number
b
and then adding 1 to the result.

16

ENG237 Basic Electricity & Electronics I

Radix - 1

Radix - 1

17

ENG237 Basic Electricity & Electronics I

Radix - 1

Radix - 1

18

ENG237 Basic Electricity & Electronics I

Complements in Number
N mber Systems
S stems
2. Radix-minus-one complement

Radix - 1

Radix - 1

19

ENG237 Basic Electricity & Electronics I

Radix - 1

Radix - 1

20

ENG237 Basic Electricity & Electronics I

(2

1 the N-bit no.

e.g. For
F a 4-bit
4 bit no., 2 N 1 = 10000 1 = 01111

(2

1 the N-bit no. + 1

11' s complement + 1

21

ENG237 Basic Electricity & Electronics I

22

ENG237 Basic Electricity & Electronics I

Subtraction Using Complements

23

ENG237 Basic Electricity & Electronics I

24

ENG237 Basic Electricity & Electronics I

25

ENG237 Basic Electricity & Electronics I

(1000 101) + 1000


= 011 + 1000
= 1011

(1000 001) + 1000


= 111 + 1000
= 1111
Or simply, find the
2comp. of 1 and
then add a sign bit.
2s comp of
001=110+001
=111
26

ENG237 Basic Electricity & Electronics I

27

ENG237 Basic Electricity & Electronics I

28

ENG237 Basic Electricity & Electronics I

Overflow Condition in 22ss Complement


Representation
1. When two words of the same sign are added together,
overflow may occur.
occur
2. When two words of the opposite sign are added together,
overflow will never occur.
occur

Example:
The value for which a 44-bit
bit signed 22ss complement no. that can
be represented are between the range of -8 to +7.

29

ENG237 Basic Electricity & Electronics I

30

ENG237 Basic Electricity & Electronics I

Signed 1s Complement Representation

The values for which


a 4-bit 1s compl.
Rep. can represent
are between
b
-77 andd
+7.

31

ENG237 Basic Electricity & Electronics I

Subtraction Using 1s Complement

32

ENG237 Basic Electricity & Electronics I

Comparison of Three Representations

(+0 and -0)

33

ENG237 Basic Electricity & Electronics I

Summary
y of Objectives
j
After completing
p
g this section,, you
y should be able
to:
1. Understand how to use numbers of different
bases to represent a quantity.
2. Convert numbers in one base to numbers of
another base, especially in binary, octal, decimal,
and hexadecimal bases.
3. Understand the function and conversion of
signed binary codes.
34

ENG237 Basic Electricity & Electronics I

Logic Functions and Boolean Algebra

The term digital systems represent quantities or


systems that can have only certain fixed values.
a lamp (two states)
a digital computer
The term analog
analog systems
systems refer to the quantities or
systems which can have any value within a given
range.
range
the signal waveform such as sine wave
35

ENG237 Basic Electricity & Electronics I

Logic Functions and Boolean Algebra

Within a computer, transistors operate like switches,


beingg either ON or OFF.

Complicated functions performed by a computer are


accomplished by interconnecting large numbers of
switches called logic gates
gates.

36

ENG237 Basic Electricity & Electronics I

Logic Functions and Boolean Algebra

The mathematical techniques for logical analysis of


systems containing large numbers of ON-OFF elements
is called Boolean Algebra.

Boolean
oo ea algebra
a geb a iss similar
s
a to the
t e ordinary
o d a y algebra
a geb a but
based on only 2 possible states, ON-OFF (or TRUEFALSE,
S , or 1-0)) called logic
g states.

37

ENG237 Basic Electricity & Electronics I

Logic Functions

Three basic logic functions:

NOT
AND
OR

38

ENG237 Basic Electricity & Electronics I

NOT Function (1)


1 light OFF
S=
0 light ON
1
S

state = L
lit
Li ht bulb
Light
b lb =
not lit state = NOT L or L

39

ENG237 Basic Electricity & Electronics I

NOT Function (2)


if light is lit (ON,
(ON TRUE)
1
L=
0 if light is not lit (OFF, FALSE)
Remarks:
1. The logic variable L is a binary (2-value) variable.
2. L and L are said to be complementary.
3. The variables are often represented
p
byy 1 and 0.
40

ENG237 Basic Electricity & Electronics I

NOT Function (3)

The logic NOT function is called a NOT gate.

Circuit symbol of a NOT gate

41

ENG237 Basic Electricity & Electronics I

NOT Function (4)

To keepp track of what state the lamp


p will be in for
each switch position, we use a table format, called a
true table.
S

L=S

Truth table
42

ENG237 Basic Electricity & Electronics I

AND Function (1)

The AND llogic


Th
i function
f ti relates
l t two
t or more
logic variables.
S1

S2

S1
S2

AND

Light bulb L

A simple
i l circuit
i it utilizing
tili i AND gate
t
43

ENG237 Basic Electricity & Electronics I

AND Function (2)

The lamp (L) will turn on if the 2 separate switches S1 and S2


are closed.
closed

L = S1 S2 where is read as AND.


A
0

B
0

L
0

Truth table

44

ENG237 Basic Electricity & Electronics I

OR Function

The OR logic function relates two or more logic variables.

S1

OR

S1
S2
V

S2

Light bulb L

A simple
i l circuit
i i utilizing
ili i OR gate
45

ENG237 Basic Electricity & Electronics I

OR Function (cont.)
The lamp (L) will turn on when one of the two switches (S1
or S2) is closed.
closed
L = S1 + S2 where + is read as OR.

Truth table

46

ENG237 Basic Electricity & Electronics I

Combining
g Basic Logic
g Functions ((1))
A logic circuit composes of NOT and AND logic functions.

C=A

X=C.B

X = AB
47

ENG237 Basic Electricity & Electronics I

Combining Basic Logic Functions (2)


A logic circuit consists of NOT, OR, and AND logic functions

D=A.B

E=D

X=E+C

X = AB+C
48

ENG237 Basic Electricity & Electronics I

Combining Basic Logic Functions (3)


A farmer has a large dog, a goat, and several heads of cabbage. In addition, the
f
farmer
owns 2 barns;
b
a northh barn
b
andd a southh barn.
b
The farmer, dog, cabbages, and goat are all in the south barn. The farmer has
chores to p
perform in both barns.
However, if
(1) The dog is left with the goat when the farmer is absent, he will bite the
goat,
t andd if
(2) The goat is left alone with the cabbages, he will eat the cabbages.
To avoid either disasters, the farmer asks us to build a small portable computer
having 4 switches, representing the farmer, dog, goat, and cabbages.
49

ENG237 Basic Electricity & Electronics I

Combining Basic Logic Functions (4)


If a switch is connected to a battery, the character represented by the switch
is in the south barn; if a switch is connected to ground,
ground the character is in
the north barn.
The output of the computer goes to a lamp, which lights if any combination
of switches will result a disaster.
How do we build this computer?

50

ENG237 Basic Electricity & Electronics I

Combining Basic Logic Functions (5)


The lamp will lit if any of the following 4 possibilities occurs:
(1) The farmer is in the north barn AND the dog AND the goat are in the south
barn, OR if
(2) The farmer is in the north barn AND the goat AND the cabbages are in the
south ba
sou
barn,, O
OR if
(3) The farmer is in the south barn AND the dog AND the goat are in the north
barn, OR if
(4) The farmer is in the south barn AND the goat AND the cabbages are in the
north barn.

51

ENG237 Basic Electricity & Electronics I

Combining Basic Logic Functions (6)


Symbolically,
D = Dog in the south barn;

D = Dog in the north barn

G = Goat in the south barn;

G = Goat in the north barn

C = Cabbages in the south barn;

C = Cabbages in the north barn

F = Farmer in the south barn;

F = Farmer in the north barn

The symbolic logic statement which combines all the possibilities


leading to a disaster is:
L = F D G + F G C + F D G + F G C

(L indicates that the light is ON)


52

ENG237 Basic Electricity & Electronics I

53

ENG237 Basic Electricity & Electronics I

Boolean Algebra (1)


No.

Theorem

Name

1a

A+B=B+A

Commutative

1b

AB=BA

2a

(A + B) + C = A + (B + C)

2b

(A B) C = A (B C)

3a

A (B + C) = A B + A C

3b

A + (B C) = (A + B) (A + C)

4a

A+A=A

4b

AA =A

5a

(A) = A

5b

A=A

6a

A+A B =A

Associative
Distributive
Identity
Negation
Redundancy
54

ENG237 Basic Electricity & Electronics I

Boolean Algebra (2)


No.

Theorem

6b

A (A + B) = A

7a

0+A=A

7b

1A=A

7c

1+A=1

7d

0A=0

8a

A+A= 1

8b

AA=0

9a

A+AB=A+B

9b

A (A + B) = A B

10a

A+B=AB

10b

AB=A+B

Name

De Morgans theorem

55

ENG237 Basic Electricity & Electronics I

Proof by Truth Table (1)


Theorem 6a. A + A B = A
A

AB

A+AB

56

ENG237 Basic Electricity & Electronics I

Proof by Truth Table (2)


Theorem 9a. A + A B = A + B

A+B

A+B

1
57

ENG237 Basic Electricity & Electronics I

Proof by
y Algebraic
g
Manipulations
p
Theorem 3b. (A + B) (A + C) = A + B C
(A + B) (A + C)
= (A + B) A + (A + B) C
= A (A + B) + C (A + B)
= AA+ AB+CA+C B
= A + A B + A C + B C
= A (1 + B + C) + B C
= A + BC

58

ENG237 Basic Electricity & Electronics I

Algebraic
g
Simplifications
p
& Manipulations
p
A (A B + C)
= A A B + A C
= A B + AC
= A (B + C)
AB+ AB+ AB
= (A + A) B + A B
= 1 B + A B
= B+ AB
= B+ A
59

ENG237 Basic Electricity & Electronics I

NAND Function (1)

All possible logic circuits can be produced by combining basic


AND, OR and NOT gates.
However most commercially available logic gates do not
However,
readily perform the AND, OR and NOT operations.
They do perform the combined operations of AND
AND-NOT
NOT
(NAND) or OR-NOT (NOR).

60

ENG237 Basic Electricity & Electronics I

NAND Function (2)

E
A

D
AND

NOT

OR

A
B

5x
NAND

C
61

ENG237 Basic Electricity & Electronics I

NAND Function (3)


2-variables:
n-variables:

L = AB
L = A B C D

AB

NAND

Truth table

62

ENG237 Basic Electricity & Electronics I

NAND Function (4)

Fig. 1.9

Circuit symbol of NAND gates

Circuit symbol
63

ENG237 Basic Electricity & Electronics I

NOR function (1)


2-variables:
n variables:
n-variables:

L = A+ B
L = A + B + C + D

A+B

NOR

Truth table

64

ENG237 Basic Electricity & Electronics I

NOR function (2)

Circuit symbol
65

ENG237 Basic Electricity & Electronics I

Exclusive-OR Function (1)


L = AB
A

Truth table
66

ENG237 Basic Electricity & Electronics I

Exclusive-OR Function (2)

Circuit

Circuit symbol

67

ENG237 Basic Electricity & Electronics I

Additional Examples on Using Boolean Algebra (1)


1. F = (AB)A (AB)B
= (AB)A + (AB)B

X Y = X + Y

= (A + B)A + (A + B)B

where X = (AB)A and Y = (AB)B

(10b)

= AA + AB + AB + BB
= AB + AB
= AB

2. F = A B D + A B C D + A B C D
= A B D + A B D(C
( + C))
= B D(A + A)
=B D
68

ENG237 Basic Electricity & Electronics I

Additional Examples on Using Boolean Algebra (2)


X + Y = X Y

(10a)

where X = A B C + A C D and Y = A C D + B C D + B C D

3. F = A B C + A C D + A C D + B C D + B C D
= (A B C + A C D) (A C D + B C D + B C D)
= (A B C + A C D) (A + C + D + B C D + B C D)
= A A B C+A A C D+A B C C+A C C D+A B C D+A C D D
=AB C+AB C+AB C D
= A B C(1 + D)
=ABC

69

ENG237 Basic Electricity & Electronics I

Designing Logic Circuits Using NAND Gates only (1)

70

ENG237 Basic Electricity & Electronics I

Designing Logic Circuits Using NAND Gates only (2)

A+B= A B

71

ENG237 Basic Electricity & Electronics I

Designing Logic Circuits Using NAND Gates only (3)

F = AB + CD
= AB CD

72

ENG237 Basic Electricity & Electronics I

Designing Logic Circuits Using NAND Gates only (4)

F = ABC + D
= ABC D

73

ENG237 Basic Electricity & Electronics I

Designing Logic Circuits Using NOR Gates only (1)

A+ B= A+ B

74

ENG237 Basic Electricity & Electronics I

Designing Logic Circuits Using NOR Gates only (2)

AB = A+ B

75

ENG237 Basic Electricity & Electronics I

Designing Logic Circuits Using NOR Gates only (3)

(A + B)(A + C) = A + B + A + C

76

ENG237 Basic Electricity & Electronics I

Standard Forms For Logic Functions


Two standard forms of Boolean expressions:
Sum of Products
Product of Sums

77

ENG237 Basic Electricity & Electronics I

Sum of Products (1)

The logic function is written as a simple sum of terms is


called
ll d a sum-of-products
f
d
f
form.
In each term, variables are connected with AND
operators.
operators
Examples:
1. L = A B C + D E F + G H I
2. L = ((W + X Y )(
)(X + Y Z )
= (W + X Y ) X + (W + X Y ) Y Z
= W X + X Y + W Y Z + X Y Z
78

ENG237 Basic Electricity & Electronics I

Sum of Products (2)


A expanded sum-of-products form is every term involves
all the variables.
variables

Example:

L = W X + X Y + W Y Z + X Y Z
= W X Y + W X Y + X Y + W Y Z + X Y Z
= W X Y Z + W X Y Z + W X Y + X Y + W Y Z + X Y Z

79

ENG237 Basic Electricity & Electronics I

Sum of Products (3)


Example:
l
From Row 2,
2
L = 1 when X = 0, Y = 1, and Z
= 0. Thus, X Y Z = 1

From Row 4,
L = 1 when X = 1, Y = 0, and Z =
0 Thus,
0.
Thus X Y Z = 1

Row

1
1
1

1
1

80

ENG237 Basic Electricity & Electronics I

Sum of Products (4)


Row

1
1
1

1
1

Similarly, Rows 3,
Similarly
3 6,
6 and 7
lead to different
combination
off the
th variables
i bl

L = X Y Z + X Y Z + X Y Z + X Y Z + X Y Z
81

ENG237 Basic Electricity & Electronics I

Sum of Products (5)


( )

For each individual product term with the output logic is 1,


it is called a minterm.

The logic equation in the previous example can be written as:

L = (2, 3, 4, 6, 7)
m

Row numbers (decimal


equivalent)
82

ENG237 Basic Electricity & Electronics I

Product of Sums (1)


( )

Product-of-sums form is written as a simple


p product
p
of
terms.
The OR operators are interconnected variables in each
term.
Example:
L = (A + B + C)(D + E + F)(G + H + I )

83

ENG237 Basic Electricity & Electronics I

Product of Sums (2)


Example:
Consider Row 0,
0 L = 0 when
X = 0 and Y = 0, and Z = 0,
i.e.
L = X Y Z
L = X Y Z
= X +Y + Z

Row

0
1
2
3
4
5
6
7

0
0

84

ENG237 Basic Electricity & Electronics I

Product of Sums (3)

L = X +Y + Z

L = X +Y + Z

Row

0
1
2
3
4
5
6
7

0
0

L = (X +Y + Z ) (X + Y + Z ) (X + Y + Z )
85

ENG237 Basic Electricity & Electronics I

Product of Sums (4)

For each individual summing term with the output logic


is 0, it is called a maxterm.

The logic equation can be expressed as

L = ((0,1,
, , 5))
M

86

ENG237 Basic Electricity & Electronics I

Expressions with All NAND or All NOR Operations

De Morgans
Morgan s theorems can simplify all the possible logic
functions which contains one type of logic gate.
Procedure for designing a NAND-only circuit
1. Convert the logic expression to sum
sum-of-products
of products form.
2. Draw the corresponding two-level AND-OR circuit and
change
g all ggates to NAND.

87

ENG237 Basic Electricity & Electronics I

Expressions with all NAND operations (1)


Example:
p L = X Y + X Z

AND-OR circuit

NAND gate implementation


88

ENG237 Basic Electricity & Electronics I

Expressions with all NAND operations (2)


L = X Y + X Z
= X Y + X Z
= (X + Y ) + (X + Z )

Row 3: + in the middle should be

= (X + Y )(X + Z )
= (X Y
Y ) (X Z )

89

ENG237 Basic Electricity & Electronics I

Expressions with all NOR operations (1)

Procedure for designing a NOR-only circuit


1. Convert the logic expression to product
product-of-sums
of sums form.
2. Draw the corresponding two-level AND-OR circuit and
change
g all ggates to NOR.

90

ENG237 Basic Electricity & Electronics I

Expressions with all NOR operations (2)


Example:

L = X Y + X Z
= (X + Y )(X + Z )

OR AND circuit
OR-AND
i i

NOR gate implementation


91

ENG237 Basic Electricity & Electronics I

Karnaugh Map (K-map) (1)


Algebraic simplification is not always easy.
The Karnaugh map provides a graphical technique for
reducingg logic
g equations
q
to a minimal form.
It is an array of cells which contains all the information
i the
in
th truth
t th table.
t bl
The Karnaugh map allows a quick visual simplification
of the logic equation.

92

ENG237 Basic Electricity & Electronics I

Karnaugh Map (2)

A map can be read in exactly the same way as a truth table in


order to write the logic equation.
equation
A

AB

AB

=0

AB

AB

=1

A two variables K-map with


cell designation shown.
93

ENG237 Basic Electricity & Electronics I

Karnaugh Map (3)

The zeros are not explicitly written and an empty cell is


assumed to contain a zero.

B
0
1

A 0

B
0

A 0

1
1

A simple
i l K-map
94

ENG237 Basic Electricity & Electronics I

Karnaugh Map (4)

The usefulness of the K-map lies in the fact that adjacent


cells can be grouped visually to reduce redundant
variables.

Rules for simplification using a 2-variable map:


A group of 2 adjacent cells combines to yield a single
variable.
A single cell which cannot be combined represents a
2
2-variable
i bl term.
t

95

ENG237 Basic Electricity & Electronics I

Karnaugh Map (5)


Example:

Row

L = AB+ AB+ AB

Consider Rows 1 and 3 only:

L1 = A B + A B = B

Consider Rows 2 and 3 only:

L2 = A B + A B = A

L = L1 + L2 = A + B
96

ENG237 Basic Electricity & Electronics I

Karnaugh Map (6)


Example:
p

L = AB+ AB+ AB
A

L = A+ B

1
1

A
97

ENG237 Basic Electricity & Electronics I

3-variable Karnaugh Map (1)

Contains 8 cells.
Each cell represents the logic product of all 3 variables.
AB
00
C

01

11

ABC

ABC

10

98

ENG237 Basic Electricity & Electronics I

3-variable Karnaugh Map (2)


Rules for simplification using a 3-variable map:

A group of 4 adjacent cells (in lines or square)


combines to yield a single variable.

A group of 2 adjacent cells combines to yield a


2-variable term.

A single cell which cannot be combined


represents a 3-variable term.

99

ENG237 Basic Electricity & Electronics I

3-variable Karnaugh Map (3)


A
Example:
AB
00
C

01

0
1

11

10

L = ABC + ABC + ABC + ABC + ABC + ABC


= A+C
100

ENG237 Basic Electricity & Electronics I

3-variable Karnaugh Map (4)


Example:
AB
C

00

01

11

10

L=B
101

ENG237 Basic Electricity & Electronics I

4-variable Karnaugh Map (1)


AB

Contains 16 cells.
Each cell represents the
l i product
logic
d off all
ll 4
variables.

CD

00

01

11

10

00
01
11
10

102

ENG237 Basic Electricity & Electronics I

4-variable Karnaugh Map (2)


Rule for simplification of a 4-variable map:
A group of 8 adjacent cells combines to yield a
single variable.
A group of 4 adjacent cells combines to yield a 2variable term.
A group of 2 adjacent cells combines to yield a 3variable term.
A single
i l cell
ll which
hi h cannot be
b combined
bi d represents
a 4-variable term.
103

ENG237 Basic Electricity & Electronics I

4-variable Karnaugh Map (3)


Example: L = A B C D + A B C D + A B C D + A B C D
+A
A BC D + A BC D + A BC D + A BC D
AB
CD
00

00

01

11
1

01
11
10

10

1
1

1
104

ENG237 Basic Electricity & Electronics I

ABD

4-variable Karnaugh Map (4)


AB

Example:

CD
00

00

01

11

10

ABD

ABCD
01
11
CD

10

1
1

L = A BC D + A B D + A B D + C D
105

ENG237 Basic Electricity & Electronics I

4-variable Karnaugh Map (5)


Example: Use the Boolean algebra or otherwise to simplify the
f ll i Boolean
following
B l
expression:
i
L = A BC D + A BC D + A BC + AC D + AC D

L = A BC D + A BC D + A BC D + A BC D +
A BC D + A BC D + A BC D + A BC D

106

ENG237 Basic Electricity & Electronics I

4-variable Karnaugh Map (6)


AC

AB

CD

AB

00

01

00

01

11

10

BCD

11

10

L = AC + A B + BC D
107

ENG237 Basic Electricity & Electronics I

Example on Using Karnaugh Map (1)


In a certain corporation the board members own all the stock,
which
hi h is
i distributed
di ib d as follows:
f ll
A owns 45%
B owns 30%
C owns 15%
D owns 10%
Each member has a percentage vote equal to his holdings. A
lamp will be light if the total vote cast is more than 50% which
indicates the motion is passed.

108

ENG237 Basic Electricity & Electronics I

Example on Using Karnaugh Map (2)


Design an electronic voting system for the corporation.

In the board room, each member is to have a switch to indicate


a YES or NO vote.
t
A lamp is to light if the total vote cast is greater than 50%.

109

ENG237 Basic Electricity & Electronics I

Example on Using Karnaugh Map (3)

Procedure

Write the truth table.


Convert the truth table into a K-map.
Draw the logic circuit using

(i) NAND gates only


(ii) NOR gates only

NO vote = 0 (open switch)


YES vote = 1 (close switch)
110

ENG237 Basic Electricity & Electronics I

Truth table

Total

45%

30%

15%

10%

10

15

25

30

40

45

55

45

55

10

60

11

70

12

75

13

85

14

90

15

100

111

ENG237 Basic Electricity & Electronics I

Example on Using Karnaugh Map (5)


From the truth table, there are 8 combinations of the 4 input
variables is sufficient to pass a motion.

L = A BC D + A BC D + A BC D + A BC D
+A
A BC D + A BC D + A BC D + A BC D

112

ENG237 Basic Electricity & Electronics I

Example on Using Karnaugh Map (6)


AB
AB
00
CD

BC D

01

11

10

00

01

AD

AC

11
10

L = BC D + A B + AC + A D
113

ENG237 Basic Electricity & Electronics I

Example on Using Karnaugh Map (7)


Two-level
wo eve AND-OR
N O logic
og c

AND-OR circuit implementation

114

ENG237 Basic Electricity & Electronics I

Example on Using Karnaugh Map (8)


NAND gate circuit

All NAND gates implementation

115

ENG237 Basic Electricity & Electronics I

Example on Using Karnaugh Map (9)


AB

00

01

00

01

11

10

CD

AC

AB

11

10

BC D
K-map for all NOR
implementation

AD

L = (B + C + D) (A + C) (A + B) (A + D)
116

ENG237 Basic Electricity & Electronics I

Example on Using Karnaugh Map (10)

OR-AND logic circuit

OR AND circuit
OR-AND
i i iimplementation
l
i
117

ENG237 Basic Electricity & Electronics I

Example on Using Karnaugh Map (11)

NOR-only circuit

All NOR gates implementation


118

ENG237 Basic Electricity & Electronics I

Additional Examples
AE1. A warning light is to grow when the mains switch (S) is
on provided
id d that
th t either
ith switches
it h A andd B or C andd D are
turned on. Assume that logics 1 and 0 are produced when a
switch is closed and opened respectively, design a minimal
circuit using NAND gates to produce a logic 1 signal when
the light is on. Redesign the circuit using two-input NAND
gates only.

119

ENG237 Basic Electricity & Electronics I

The output Z = f (A, B,C, D, S)


AB
CD

AB
00 01 11 10

CD

00
01

00 01 11 10
1
00
1
01

11

11 1

10

10
S

Z = (AB + CD)S

1
S

= ABS + CDS
= ABS + CDS
= ABS CDS

120

ENG237 Basic Electricity & Electronics I

Two input NAND gates only:


Z = (AB + CD)S
= (AB CD)S
= (AB CD)S

121

ENG237 Basic Electricity & Electronics I

Additional Examples
AE2. A chemical process is activated only if at least three out of
four keys are inserted.
inserted Assuming that an inserted key produces
a logic 1, design a minimal circuit to achieve this using (1)
AND, OR, and NOT gates, and (2) NAND gates only.
AB
CD

00 01 11 10
00
01
11
10

F = ABD + ABC + ACD + BCD

1
1

1
122

ENG237 Basic Electricity & Electronics I

123

ENG237 Basic Electricity & Electronics I

Summary of Objectives
After completing this section, you should be able to:
1. Understand the function and apply the three basic logic gates
for more complex
p logic
g expressions.
p
2. Understand and apply Boolean equations, truth tables, or
logic diagrams to describe combinational logic.
3. Understand and apply Karnaugh maps.
4. Design logic circuits with only NAND gates or only NOR
gates.
gates
5. Understand the motivation of using only one type of logic
gates.
124

S
Sequential
ti l Circuits
Ci it

125

ENG237 Basic Electricity & Electronics I

Introduction
Combinational circuits provide output signals upon
application of input signals which are assumed to
be available at the same time.
Memory elements are required to store information
for most digital systems
systems.
Combinational circuits become sequential circuits
when
h th
the memory elements
l
t are added.
dd d

126

ENG237 Basic Electricity & Electronics I

Memory Elements
Three types:
1. Flip-flops
constructed from logic gates.
capable of storing 1-bit of information as long as required.

2. Registers
g
constructed from flip-flops.
used to store and manipulate multi
multi-bit
bit data.

3. Counters
count the number of bits applied to registers
registers terminals.
terminals
127

ENG237 Basic Electricity & Electronics I

Flip-Flops
1. Set-Reset (SR) Flip-Flops

Qn+1

Qn

Not Allowed

Truth table
128

ENG237 Basic Electricity & Electronics I

SR latch with NAND gates

129

ENG237 Basic Electricity & Electronics I

Clocked SR flip-flop

The clock signal is used to synchronize the two inputs.


inputs
130

ENG237 Basic Electricity & Electronics I

SR circuit symbol

131

ENG237 Basic Electricity & Electronics I

Delay (D) Flip-Flops


Similar to SR flip-flops, except they have only one
input.

132

ENG237 Basic Electricity & Electronics I

Truth and Excitation Tables


D

Qn

Qn+1

Qn

Qn+1

133

ENG237 Basic Electricity & Electronics I

Circuit Symbol

134

ENG237 Basic Electricity & Electronics I

JK Flip-Flops
The most commonly used flip-flops.

135

ENG237 Basic Electricity & Electronics I

Truth and Excitation Tables


Qn

Qn+1

No Change

Reset

Set

Qn

Toggle

Qn+1

Qn

1
1

136

ENG237 Basic Electricity & Electronics I

Circuit Symbol

137

ENG237 Basic Electricity & Electronics I

Toggle (T) Flip-Flops

138

ENG237 Basic Electricity & Electronics I

Truth and Excitation Tables


T

Qn

Qn+1

Qn

Qn+1

139

ENG237 Basic Electricity & Electronics I

Circuit Symbol

140

ENG237 Basic Electricity & Electronics I

Registers

Registers
R
i
are constructedd with
i h flip-flops
fli fl
andd usedd
for storing binary data.
One flip-flop is used for each bit.
Interconnectingg flip-flops
p p obtains multi-bit
registers.

141

ENG237 Basic Electricity & Electronics I

Examples

A two-bit parallel-in and parallel-out memory register.


142

ENG237 Basic Electricity & Electronics I

A two-bit shift register.


143

ENG237 Basic Electricity & Electronics I

A mod-3 shift register ring counter.

144

ENG237 Basic Electricity & Electronics I

Counters
Counting circuits are a class of sequential circuits that
require
i no external
t
l input
i
t andd may be
b clocked
l k d or
unclocked.
Clocked
Cl k d system is
i triggered
i
d by
b a master clock,
l k is
i
called synchronous.
A combinational operations trigger other operations,
y
operation.
p
this is called asynchronous

145

ENG237 Basic Electricity & Electronics I

Timing Waveforms
rising edge

falling edge

Timing waveform to demonstrate the risingrising and falling


falling- edges triggering.

Symbol used for


rising edge
triggered flip-flop
flip flop

Symbol used for


falling edge
triggered flip-flop
146

ENG237 Basic Electricity & Electronics I

Asnchronous Counters

No clock pulse is required to control its


operation.
operation
Next operation depends on previous state.

147

ENG237 Basic Electricity & Electronics I

Modulus-8 Ripple Counter

Modulus (MOD) of a counter is the number of states


that a counter goes through before it re-cycles.
p p the maximum number of
For N numbers of flip-flops,
states is 2N and the countable range is 0 to 2N-1.
148

ENG237 Basic Electricity & Electronics I

Timing Diagram

B
MSB

149

ENG237 Basic Electricity & Electronics I

Synchronous Counters
Synchronous
S
h
circuit
i it has
h a master
t clock,
l k the
th
operation speed is depending the clock
speed.

150

ENG237 Basic Electricity & Electronics I

A synchronous decade (MOD-10) counter


using JK flip-flops
A

Count table

151

ENG237 Basic Electricity & Electronics I

Truth and Excitation Tables


Qn

Qn+1

No Change

Reset

S
Set

Qn

Toggle

Qn+1

Qn

1
1

152

ENG237State
Basic Electricity &
Electronics
Present
Next
State I

Excitation

No

A
A

B
B

C
C

D
D

JA

KA

JB

KB

JC

KC

JD

KD

10

11

12

13

14

15

State table and the transition for JK flip-flops.

153

ENG237 Basic Electricity & Electronics I

K-Maps
AB
CD

00

01

11

AB

10

00

01

11

10

CD

00

00

01

01

11

10

11
10

JA = B C D

KA = D
154

ENG237 Basic Electricity & Electronics I

K-Maps
AB

AB
00

01

11

10

01

11

10

01

11

10

CD

CD
00

00

00

01

11

10

JB = C D

KB = C D
155

ENG237 Basic Electricity & Electronics I

K-Maps
AB
CD

00

01

11

AB

10

01

00

11

10

CD

00

00

01

01

11

11

10

10

JC = A D

KC = D
156

ENG237 Basic Electricity & Electronics I

K-Maps
AB

AB
00

01

11

10

C
CD

00

11

01

10

CD

00

00

01

01

11

11

10

10

JD = 1

KD = 1
157

ENG237 Basic Electricity & Electronics I

Circuit realization

158

ENG237 Basic Electricity & Electronics I

Mod-8 Binary Counter


To illustrate the design procedure, the circuit
will be designed by using (i) SR flip-flops,
and (ii) JK flip
flip-flops.
flops

159

ENG237 Basic Electricity & Electronics I

1. Using SR Flip-Flops
Qn

Qn+1

SR Excitation table
160

ENG237 Basic Electricity & Electronics I

State and Transition Table


Preset State

Next State

SR Excitations

SA

RA

SB

RB

SC

RC

1
161

ENG237 Basic Electricity & Electronics I

K-Maps
AB
00

C
0

01

11

X
1

10

AB

C
0

00

C
0
1

00

X
X

01

11

X
1

RA = ABC

11

10

SA = ABC
AB

01

AB
C
0

00

01

11

10

SB = BC
10

AB
C
0
1

00

01

11

SC = C
10

X
1

RB = BC

AB
C
0
1

00

01

11

10

RC = C
162

ENG237 Basic Electricity & Electronics I

Circuit Realization

163

ENG237 Basic Electricity & Electronics I

2. Using JK Flip-Flops
Qn

Qn+1

JK Excitation table
164

ENG237 Basic Electricity & Electronics I

State and Transition Table


Preset State

Next State

JK Excitations

JA

KA

JB

KB

JC

KC

165

ENG237 Basic Electricity & Electronics I

K-Maps
AB
C
0

01

00

11

10

AB

C
0

00

JA = BC
AB
C
0
1

00

01

11

01

11

10

AB
C
0

00

01

11

10

JB = C
10

KA = BC

AB
C
0

00

01

11

X
1

KB = C

JC = 1
10

AB

00

01

11

10

C
0

KC = 1
166

ENG237 Basic Electricity & Electronics I

Circuit Realization

167

ENG237 Basic Electricity & Electronics I

Summary of Objectives
After completing this section, you should be able to:
1 Understand
1.
U d
d and
d apply
l the
h function
f
i off SR,
SR D,
D T,
T andd
JK Flips.
2 Understand
2.
U d
d the
h ffunction
i off registers.
i
3. Understand and apply truth table, excitation table,
state transition
i i table,
bl andd K-map
K
to design
d i simple
i l
counters.
4 Understand
4.
U d
d and
d apply
l rising
i i andd falling
f lli edge
d
triggerings.
168

S-ar putea să vă placă și