Download as pdf or txt
Download as pdf or txt
You are on page 1of 19

Course notes for City and Guilds 8030-22-212, (2000 onwards)

212.43 Basic Logic Circuits:


Logic functions are digital operations. By Digital is meant systems that in normal operation have only two states, often reffered to as High or Low, True or False On or Off, 1 or 0 These states are normally represented in digital electronic systems as Voltages, with a High being represented by 5V and a LOW represented by 0V (in TTL version of logic more on this later). There are three basic logic operations that can be defined:

AND Or Not

The operation of each can be explained using truth tables. A truth table lists the output for a system for each and every possible input to the system. The logic operations form part of a branch of mathamtics called Boolean Algebra, which has a set of rules and symbols of it own.

AND
The output is true if input A and input B are true.

A F F T T

B F T F T

X A and B F F F T

Drawing Symbol:
A & B X A B X

IEC617:12

Mil-STD-806

Boolean expression: X = A.B ( Pronounced X equals A and B) The operation can be restated as
The output is on if input A and input B are on. The output is high if input A and input B are high. The output is 1 if input A and input B are 1.

P1

10/10/03

OR
The output is true if input A or input B is true.

A F F T T

B F T F T

X A or B F T T T

Drawing Symbol:
A B 1 X A B X

IEC617:12 Boolean Expression:


X = A + B ( Pronounced X equals A or B)

Mil-STD-806

NOT
The output is true if the input is false.

A F T

X Not A T F

Drawing Symbol:
A X A X

IEC617:12

Mil-STD-806

Boolean Expression: X = A ( prenounced X equals A bar) From these three basic operations we can create a further 3 operations namely NAND, NOR and Exclusive OR.

P2

10/10/03

NAND
The output is false if input A and input B are true.

A F F T T

B F T F T

X A Nand B T T T F

Drawing Symbol:
A & B X A B X

IEC617:12

Mil-STD-806

Boolean expression: x = A.B ( Pronounced X equals A nand B) NOR


The output is false if input A or input B are true.

A F F T T

B F T F T

X A Nor B T F F F

Drawing Symbol:
A B 1 X A B X

IEC617:12 Boolean expression:


X = A+ B

Mil-STD-806

( Pronounced X equals A nor B )

P3

10/10/03

Exclusive OR
The output is true if one or the other, (but not both) input is true. Another way to say it is The output is true if the inputs are different.

A F F T T

B F T F T

X A XOR B F T T F

Drawing Symbol:
A =1 B X A B X

IEC617:12

Mil-STD-806

Boolean expression: X = A B ( Pronounced X equals A ex-or B )

P4

10/10/03

The Algebra of Boolean Logic: Commutive Law A+ B = B+ A order of operation is irrelevant A.B = B. A Associative Law: A + B + C = ( A + B) + C = A + ( B + C ) A.B.C = ( A.B).C = A.( B.C ) Distrubitive Law: A + ( B.C ) = ( A + B).( A + C ) A.( B + C ) = A.B + A.C De Morgans Theorem: A.B = A + B A + B = A.B Useful identies: For OR A+0 = A
A +1 =1 A+ A= A A+ A =1

For And A.0 = 0


A.1 = A A. A = A A. A = 0

For Not A= A

P5

10/10/03

Proofs of above Commutive law A+B A B 0 0 0 1 1 0 1 1 B+A B A 0 0 0 1 1 0 1 1

A+B 0 1 1 1

B+A 0 1 1 1

Thus A+B = B+A Associative Law (A+B)+C A B C 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 A+(B+C) A B 0 0 0 0 0 1 0 1 1 0 1 0 1 1 1 1

A+B 0 0 1 1 1 1 1 1

(A+B)+C 0 1 1 1 1 1 1 1

C 0 1 0 1 0 1 0 1

B+C 0 1 1 1 0 1 1 1

A+(B+C) 0 1 1 1 1 1 1 1

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

P6

10/10/03

De Morgans Law A.B A B A.B 0 0 0 0 1 0 1 0 0 1 1 1


A+ B A 0 0 1 1

A.B 1 1 1 0

B 0 1 0 1 Hence A.B

A B 1 1 1 0 0 1 0 0 = A+ B

A+ B 1 1 1 0

Example: A burgular alarm system consists of the following inputs: A 24 hour loop (A=1 means 24 hr loop OK, A=0 means 24 hr loop fault) B Ineretia sensor on door (B=1 means sensor moving, B=0 means door stationary) C Magnetic contact on door (C=1 means door open, C=0 means door closed). Output: X Alarm Bell (X=1 means bell ringing, X=0 bell silent) It is required to signal the presence of an intruder if X = A.B.C + A.B.C + A.B.C
(Note: A.B.C reads as 24 Hr loop OK and Door moving and Door open)

X = A.B.C + A.B.C + A.B.C X = A.B.C + A.B.C + A.B.C Commutive Law X = A.B.(C + C ) + A.B.C Distrubitive law Now A+ A =1 X = A.B.1 + A.B.C X = A.B + A.B.C since A.1 = A X = A.( B + B.C ) Distrubitive law If we had started differently.. X = A.B.C + A.B.C + A.B.C X = A.B.C + A.B.C + A.B.C + A.B.C Since A+A =A X = ( A.B.C + A.B.C ) + ( A.B.C + A.B.C )
X = A.B.(C + C ) + A.C.( B + B ) X = A.B.(1) + A.C.(1) X = A.B + A.C
P7 10/10/03

X = A.( B + C )

Example 2 A system with 3 inputs and one output behaves as follows, dertermine the operation of the system. A B C X 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 0 1 0 0 1 1 1

List the conditions that result in the output being 1. X = A.B.C + A.B.C + A.B.C + A.B.C Grouping like terms X = ( A.B.C + A.B.C ) + ( A.B.C + A.B.C )
X = B.C ( A + A) + A.C.( B + B )

X = B.C + A.C

P8

10/10/03

Asside:. Fundamentals of number systems. We normally count in the decimal number system; the digits 09 being the full set of numbers we have to work with. Other number systems are possible however. The binary number system for example has only two allowed digits: 0 and 1. Counting in the binary system proceeds as follows: Decimal Binary 0 0 1 1 2 10 3 11 4 100 5 101 6 110 7 111 8 1000 9 1001 10 1010 and so on Why bother with such a strange number system? Well the answer lies in the nature of digital electronics. Digital electronic devices employ a signalling system between themselves which is quite like Morse code. In Morse code, information is sent by flashing a light on and off in particular patterns. The lights have only two possible states: On or Off which we could represent by the numbers 1 or 0. We could conceive of a different sort of signalling system which also uses lights but which instead sends data by varying the intensity of the light. This is known as an analogue data transmission system. For example, lets say a mountain climber, high on a mountain wishes to send the number 5 to another climber, far away on a distant peak. He could flash his light 5 times for this purpose, or , he could perhaps set his light to Intensity number 5 and shine it towards the other hill. Which system will be the more reliable? Well, given the possibility of fog, bright sunlight, and overcast conditions which could effect the judgement of the recipient, it is obvious that the 5 flashes is the more reliable system as the data does not rely so much on the conditions between the mountains. It is this immunity to interference that makes digital systems so popular. In the digital electronics world, information is transferred by voltage levels rather than light levels. For most of our applications 5V is equivalent to the Morse code light being On , 0V is equivalent to the light being Off. A 5V signal is thus equivalent to a binary 1 while a 0V signal is equivalent to a binary 0 (more exotic systems exist but these are not of importance to this module). Digital electronic devices transmit sequences of pulses (5V, 0V etc.) between each other to transfer data. In many cases, the devices use several wires to transmit data and so increase the speed with which information may be transferred. The devices could be thought of as transferring binary numbers between one another.

P9

10/10/03

In general, for any number base we can say that each digit represents a quantity as shown below (for a 4 digit number).

MNPQ
Q x Number Base to the power of 0 P x Base to the power of 1 N x Base to the power of 2 M x Base to the power of 3

(remember, any number to the power of zero is 1). Thus the decimal number 1234 represents 4 x 100 i.e. 4 units + 3 x 101 i.e. 3 tens + 2 x 102 i.e. 2 hundreds + 1 x 103 i.e. 1 thousand The binary number 1010 represents 0 x 20 = no units + 1 x 21 = 1 two + 0 x 22 = no fours + 1 x 23 = 1 eight. which of course is 10. Converting from decimal to binary is accomplished by successive division by 2 as follows: Find the binary representation of 14 decimal. 2 |14 2 |7 remainder of 0 2 |3 remainder of 1 2 |1 remainder of 1 0 remainder of 1 Stop when the division produces a result of 0, gives the result 1110 binary (reading from the bottom up). In computing, two number systems (apart from decimal) are of particular importance. These are the binary number system and the hexadecimal number system. The hexadecimal number system is based on the number 16. The reason for this apparently odd choice of number base is that one hexadecimal digit can be used to represent all possible states of four binary digits thus significantly shortening the business of writing down numbers. The following table shows equivalents for some binary, hexadecimal and decimal number systems.

P10

10/10/03

Binary 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Hexadecimal 0 1 2 3 4 5 6 7 8 9 A B C D E F

Decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

How many numbers can you represent with n bits? Because each bit can be of one of two states, either 1 or 0, then the n bits can represent any of 2n , i.e. 16, numbers, in the range 0 15. However if we are not concerned with using our n bits to counts real items, like apples in a box, then we can choose to allow our bits to count through their 2n states in any fashion we choose. For instance if we have 2 light bulbs and we want to make them turn On and Off we could choose to do so as follows.
0 0 1 1 0 1 1 0

This sequence is known as a Gray Scale, it is a way of counting in which only one bit changes between states. Thus a Gray scale for 3 bits is. A B C 0 0 0 0 0 1 0 1 1 0 1 0 1 1 0 1 1 1 1 0 1 1 0 0 Note there are many different Gray scales, but so long as only one bit changes between any two states then it qualifies. End of asside.

P11

10/10/03

Karnaugh Maps. The algebraic reduction of a Boolean expression is not always easy and generally requires a certain amount of inuituin or luck. A more structured approach is to use a Karnaugh (pronouced CAR-NO) map ( or K map). This consists of a matrix of all the possible combinations of the inputs and contains the same information as a truth table, but in a different form. The truth table and K-map of a two variable function are shown below. Note there are 4 enteries in the T-T and four squares in the K map. IN the K-map the coloumns represt the states of A ( A A ) while the rows represent the states of B. A B F 0 0 0 0 1 1 1 0 1 1 1 1 B\A 0 1 0 0 1 1 1 1 From the T-T we have F = AB + A B + AB Which we can solve as before. From the K-map we group cells which have adjoining 1s and then list their requirements. In the secone coloumn (A=1) we have A B + AB = A( B + B ) =A Similarly in the second row (B=1) we have AB + AB = B Thus F = A + B In the K=map the grouping of two adjjacent squares in any row or coloumn will indicate a redudant variable. The T-T and K-map of a three variable function are shown below. There are 8 enteries in the T-T and 8 squares in the K map. When drawing a K map for 3 variables we place 2 variables along one axis and the other alone, for a 4 valiable function wed place 2 variables along each axis. When laying out the k map the order of the variables is important, an axis displaying more than one variable must be incremented using a Gray Scale. ( ie 00-01-11-10). The left most digit refers to the leftmost variable.

P12

10/10/03

A 0 0 0 0 1 1 1 1 C\AB 0 1 00 0 1

B 0 0 1 1 0 0 1 1

C 0 1 0 1 0 1 0 1 01 1 1

F 0 1 1 1 0 0 0 1 11 0 1 10 0 0

From T-T F = ABC + ABC + ABC + ABC Directly from K map F = AB + AC + BC Which we could have arrived at using long hand Boolean algebra. Weve seen that grouping two adjacant squares makes one variable redudant, looping 4 adjacant squares eliminates 2 variable looping 8 adjacant squares eliminates 3 variable etc A B C F 0 0 0 0 0 0 1 1 0 1 0 1 0 1 1 1 1 0 0 0 1 0 1 0 1 1 0 1 1 1 1 1 C\AB 0 1 00 0 1 01 1 1 11 1 1 10 0 0

P13

10/10/03

From T-T F = ABC + ABC + ABC + ABC + ABC From K-map F = AC + B Note: that the sides of the K map wrap around so that these are appropiate groups. A B C F 0 0 0 1 0 0 1 1 0 1 0 1 0 1 1 1 1 0 0 1 1 0 1 1 1 1 0 0 1 1 1 0 C\AB 0 1 00 1 1 01 1 1 11 0 0 10 1 1

From T-T F = ABC + ABC + ABC + ABC + ABC + ABC From K-map F = AB + B

P14

10/10/03

212.45 Implementing Boolean Expressions or T-Ts using Gates. The simplest way to display an expression in the form of gates is to implement each ANDed term then OR all the outputs. For neatness create a BUS of the inputs running down the left-hand-side of the page, then feed them in each time they are required. ex:
X = A.C + A.B.C

P15

10/10/03

If an indivual input term is inverted then place an inversion circle on the input to the gate. ex: X = A.C + A.B.C

Take care to differentiate between an input being inverted and the output of the AND being inverted. ex:
X = A.B + A.C + B.C

And, Nand Or and NOR gates can all be used with multiple inputs, 2, 3 .20, just draw the symbol large enough to accomadate all the incomming lines. Finally if some of the AND/NAND outputs are NORed while others are ORed then accomplish this in two stages., ex:

P16

10/10/03

X = A.B + A.C + B.C

212.46 Need for a Latch. The Digital designs we have just seen are called Combinational Logic designs. With these the output only depends upon the present status of the inputs, there is no facility to remember or store past events. If we need to design a system which requires to know past information then we need to use a memory cell, such cell is called a latch or Flip-Flop. The simplest such Latch is called an RS latch or RS Flip-Flop. Such designs are then know as Squential Logic designs. ex: In the burgular alarm we looked at before, presently X = A.( B + C ) Here the bell rings if the door moves or is open, but itll turn off as soon as the intruder shuts the door! We need to latch the ring bell signal so that once an intrusion happens the bell rings until the owner reset it. ex: The traffic light controller for a cross-roads with a zebra crossing needs to know when a pedestrian is waiting so as to alter the sequence of the lights, rather than requiring the pedestrian to hold the request button constantly in instead the button is latched, thereby they need only press the button once and this is remembered until the controller is ready to use the info. Afterwards the latch is cleared (reset) to await the next pedestrian.

212.47 Circuit Symbol and operation of RS latch. The R and S of RS are inputs that operate as follows: R Reset S Set The symbol is .

P17

10/10/03

RS R

RS R

Q
IEC617:12

Mil-STD-806

In the IEC symbol the angled line on the second output is just an alternate way of showning a inverted output, a negation circle could also be used. The RS latch operates as follows. The most important property of a RS latch is that it can only exist in one of two stable states which are Q = 1 called the Set state Q=0 And Q = 0 called the reset state Q=1 The two outputs Q and Q , which are the complement of each other. Q is normally considered as the output. The T-T is S 1 0 0 1 R 0 1 0 1
Q

1 0

Q 0

1 Unchanged Undefined

In operation the S-R inputs are usually 0-0 in which case the outputs remain the same as they were. If the inputs S-R change to 1-0 then Q will be SET to 1. The inputs can then return to S-R 0-0 and Q will remain as 1. To clear the Q output to 0 then the inputs must change to S-R 0-1, when Q will be RESET. The input condition S-R 1-1 is not allowed as the operation of the device is undefined. ex: Improve the burgular alarm seen before so the output is latched and requires a reset to turn off the bell.

P18

10/10/03

212.48 SR latch implemented using cross-coupled NAND gates.

The S input sets the Q output to 1 while R reset it to 0. When R=S=1 then the output keeps the previous value. When R=S=1 then Q=Q=1, and the latch may go to an unpredictable next state.SR latch implemented using cross-coupled NOR gates.

The following NOR gate circuit is also able to do this because of the feedback from the output back to the input - because of the fact that both Q and Q are "brought back" and connected to the inputs of the NOR gates.

The S input sets the Q output to 1 while R reset it to 0. When R=S=0 then the output keeps the previous value. When R=S=1 then Q=Q=0, and the latch may go to an unpredictable next state.

P19

10/10/03

You might also like