Sunteți pe pagina 1din 7

Computer Studies 2013 Syllabus

Logic Circuits
(2.2.4)
This handout includes; Truth values. OR, AND (2-input only) and NOT gates and their truth tables Determining the output of a logic circuit containing the three mentioned gates for given inputs.

Drawing a Circuit from a Boolean Expression


When youre given a Boolean expression such as X = NOT (A OR B) AND C you should be able to draw its logic circuit. This can be achieved by analysing the expression and seeing which gates should be drawn first. If we analyse the formula above we could gather the following information; There is one output which is X There are 3 unique inputs (A, B and C) (A OR B) must be worked out first since these are in brackets The result of (A OR B) must be passed through a NOT gate since NOT is immediately before the brackets Finally, the result of NOT (A OR B) must be passed through an AND gate along with the input of C.

Step 1: Draw all the required Inputs. A

Ms. P. Sullivan

Page 1 of 7

Computer Studies 2013 Syllabus

Step 2: Draw the first section of our expression: (A OR B)

Step 3: Move on to the next step NOT (A OR B)

Step 4: The last step is to combine the inputs of NOT (A OR B) with the input of C through and AND Gate.

A X

That gives us the complete Logic Circuit for the expression X = NOT (A OR B) AND C.

Ms. P. Sullivan

Page 2 of 7

Computer Studies 2013 Syllabus

Extracting an Expression from a Logic Circuit


In other cases, you have to be able to extract an expression from an existing logic circuit. This can be achieved by starting from the rightmost end of the circuit and expanding each output into its inputs. The following is such an example.

A B

C D F

In this case we have to start from the right hand side; that is X and start factorising X according to its elements. The following is a step-by-step breakdown of X.

Result X NOT G

Description This is the final output we start with. X is made up from NOT G as can be seen from the diagram. Now, well check what G is made of, in this case it is made up of NOT (E OR F) E and F which pass through an OR gate. Therefore we replace G with (E OR F). Since we have more than one letter we close them in brackets. Finally, we can replace both E and F by their predecessors. Both

X= NOT ((A AND B) OR (C AND D))

E and F are made up of two inputs which are passed through an AND gate. Once again notice that since both E and F are made up of more than one input these are enclosed in brackets.

Ms. P. Sullivan

Page 3 of 7

Computer Studies 2013 Syllabus

The following is another example.

A B

C D

F H

X G AND H NOT E AND H NOT E AND (F OR D) NOT (A AND B) AND (NOT C OR D)

In most cases Boolean expressions are not written down using the NOT, AND and OR notations but a symbol is used to replace them. The following are their symbols: NOT A A AND B A OR B A.B A+B

Therefore the expression in the previous example would be:

From : NOT (A AND B) AND (NOT C OR D) To : (A.B).(C+D)

Ms. P. Sullivan

Page 4 of 7

Computer Studies 2013 Syllabus

Drawing a Logic Circuit from a Situation


In certain cases a logic circuit and its truth table could be derived from a situation. Using logic circuits and truth tables makes it easier to understand how something might work. Consider the following example.

A car alarm is designed to sound when the engine is on and a seat belt is not in place or a door is open or both. Draw a logic circuit and its truth table to explain this situation.

The first step is to point out the inputs. In this case there are the engine, the seat belt and the door and the output is the alarm. So we can start by drawing the inputs.

Engine

Seat Belt

Door

If we look at the statement again, we can highlight them as follows: Engine is ON AND Seat Belt NOT in place (so engine is always 1 there is no need for a gate- , the seat belt is not in place therefore NOT is required- and finally they are combined with an AND). Engine is ON AND a Door is OPEN (engine and door do not require any gates they are just combined with an AND gate). Finally, the previous two situations are combined with an OR gate.

Ms. P. Sullivan

Page 5 of 7

Computer Studies 2013 Syllabus

All these can then be plotted into the logic circuit as shown next. Seat Belt X Y Engine Alarm

Door Z

The next step is to draw the truth table. Seat Belt Engine Door X

Y
X.Engine

Z
Engine.Door

Alarm
Y+Z

0 0 0 0 1 1 1 1

0 0 1 1 0 0 1 1

0 1 0 1 0 1 0 1

1 1 1 1 0 0 0 0

0 0 1 1 0 0 0 0

0 0 0 1 0 0 0 1

0 0 1 1 0 0 0 1

Ms. P. Sullivan

Page 6 of 7

Computer Studies 2013 Syllabus

So by looking at this truth table we can see 3 situations when the alarm will ring. So it can be used to check if the circuit has been done correctly.

Seat Belt

Engine

Door

Alarm

X.Engine
0 0 1 1 0 0 0 0

Engine.Door
0 0 0 1 0 0 0 1

Y+Z
0 0 1 1 0 0 0 1

0 0 0 0 1 1 1 1

0 0 1 1 0 0 1 1

0 1 0 1 0 1 0 1

1 1 1 1 0 0 0 0

The alarm will sound when: A: the engine is ON and the seat belt is not in place. B: the engine is ON, the seat belt is not in place and the door is open. C: the engine is ON and the door is opened.

Ms. P. Sullivan

Page 7 of 7

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