26
Mastering Logic Gates and Truth Tables WHAT IS BOOLEAN? LOGIC GATES – TYPES CORRESPONDING TRUTH TABLES DRAWING CIRCUIT DIAGRAMS VIDEOS INCLUDED (DEMOS OF LOGIC GATE) USING LOGIC.LY/DEMO *ALSO SEE PRESENTATIONS ON BOOLEAN LOGIC ase the full teaching package (KS3, GCSE and A Level topics from www.teachingcomputing.com

Mastering Logic Gates and Truth Tables WHAT IS BOOLEAN? LOGIC GATES – TYPES CORRESPONDING TRUTH TABLES DRAWING CIRCUIT DIAGRAMS VIDEOS INCLUDED (DEMOS

Embed Size (px)

Citation preview

Mastering Loops

Mastering Logic Gates and Truth TablesWhat is Boolean?Logic Gates TypesCorresponding Truth tablesDrawing circuit diagrams VIDEOS included (demos of logic gate) using logic.ly/demo*Also see presentations on boolean logic

Purchase the full teaching package (KS3, GCSE and A Level topics from www.teachingcomputing.com Did you know?Have you ever looked inside your computer? The internal circuitry of computers is a bit of a mystery. Have a look at the mother board on the right. Logic Gates play a big role in understanding the circuitry of computers. Digital systems are basically constructed using logic gates that operate using Boolean logic

Source: Wires N Code

An Electronics Project WebsiteWhat is Boolean?!In computer science, the Boolean data type is a data type, having two values (usually denoted true (1) and false (0), intended to represent the truth values of logic and Boolean algebra. It is named after George Boole, who first defined an algebraic system of logic in the mid 19th century.Example: Data type: Seat booked? Options are True (1) or False (1)

and what is a logic gate?In electronics, a logic gate is an idealized or physical device implementing a Boolean function; that is, it performs a logical operation on one or more logical inputs, and produces a single logical output.Logic gates are primarily implemented using diodes or transistors acting as electronic switches, but and this is interesting - can also be constructed using vacuum tubes, electromagnetic relays (relay logic), fluidic logic, pneumatic logic, optics, molecules, or even mechanical elements.

Logic circuits include such devices as ALUs*, computer memory, and complete CPU** chips, which may contain more than 100 million gates*Arithmetic Logic Units**Central Processing Unit (the brain of the computer)4Logic Gates and CircuitryLearning about logic gates will give you an insight into the circuitry of computers and how they work.

Youll remember that computers dont understand English all they can make sense of is: Binary (0) and (1) as computers are basically comprised of millions of on and off switches.In modern practice, most gates are made from field-effect transistors (FETs), particularly MOSFETs (metaloxidesemiconductor field-effect transistors).5Hardware Design how would you illustrate a circuit with its components?If you tried to draw the circuit on the right on paper (as it is) it probably wouldnt make much sense. Common convention uses a series of symbols to stand for the various types of logic gates. The diagram on the right is a circuit diagram showing 3 inputs and 2 outputs. You can combine logic gates to do clever things with inputs and outputs.But what do the funny shapes mean?

You may understand what it means because its your circuit, but other people would struggle!

6Types of GatesIf you are a beginner to all this, you probably would start with knowing the three main gates: the AND gate, the OR gate and the very clever NOT gate. The symbolic representations for each of these gates is shown below.AndOrNot

Yes, it would be helpful if the AND and OR gates didnt look quite so similar, but thats just the way it is now. You would do well to find an interesting way of remembering what the AND and OR gates look like, and test yourself to make sure you dont get confused.

7The And Gate remembering the shape!And

Memory by association really works. The wackier and more creative the association the more likely you are to remember what the gates stand for! Heres one (completely ridiculous way but it worked for me) Try and think of your own!This gate is ROUNDED and looks a little like the door of a cave (if rotated). A year ago I was in a desert there was loads of SAND, and there were caves nearby in which the (biblical) dead sea scrolls were found. AND!

8The Or Gate remembering the shape!OrMemory by association really works. The wackier and more creative the association the more likely you are to remember what the gates stand for! Heres one (completely ridiculous way but it worked for me) Try and think of your own!Thor was a chap that was from space. The gate above looks a little like a space ship. THOR .from outer space, and so when I see a spaceship shaped gate, I think: THOR.and remember its the OR gate.

9Other types of gatesThere are other types of gates which make use of the AND or OR symbolic representations within them

NANDNORXORXNOR10What do these gates do?Watch the video below, or create the diagram for yourself in logic.ly/demo and see what happens. Note that the gate below is the AND gate.

Connect the toggle switches (on the left) to the AND gate (centre) and then the AND gate to the bulb (output)Youll notice something quite interesting: The bulb only lights when both Input 1 AND Input 2 are on. The AND logic gate performs this function and produces an output depending on the inputs. If INPUT A = 1 (on) and INPUT B = 1 (on),Only then with the output also be on (1)Input AInput BIf Input B is ON (this represents a 1)If InputA AND InputB are on, then the bulb will be on (Boolean value = 1)AND GATE11

What do these gates do?Watch the video below, or create the diagram for yourself in logic.ly/demo and see what happens. Note that the gate below is the OR gate. Connect the toggle switches (on the left) to the OR gate (centre) and then the OR gate to the bulb (output)Youll notice something quite interesting: The bulb lights up when either Input 1 OR Input 2 are on. The OR logic gate performs this function and produces an output depending on the inputs. If INPUT A = 1 (on) OR INPUT B = 1 (on),the output also be on (1)Input AInput BIf Input B is ON (this represents a 1)If InputA OR InputB are on, then the bulb will be on (Boolean value = 1)OR GATE12 The NOT gate acts as an inverterWatch the video below, or create the diagram for yourself in logic.ly/demo and see what happens. Note that the gate below is the NOT gate. Connect the single input (toggle switch on the left) to the NOT gate, and then connect the NOT gate to the bulb.Youll notice a pattern. If the switch is on (1) then the bulb is off (0). And if the switch is off (0), then the bulb goes on (1)The NOT gate tends to invert the signal that is coming through to produce the opposite signal. If INPUT A = 1 then NOT A = 0If INPUT A = 0 then NOT A = 1Input AInput BIf Input B is ON (this represents a 1)If InputA OR InputB are on, then the bulb will be on (Boolean value = 1)NOT GATE

Input ANOT GATEIf Input A = 0 (off) then the bulb is on!13Use of a truth table weird examplesEach of the gates have a corresponding TRUTH TABLE. The truth table is an effective way of displaying the inputs and outputs of a gate using binary (Boolean values)Variable AVariable BFinal OutputX is goodX is divineBelieve!X is not goodX is divineDont believe!X is goodX is not divineDont believe!Suppose the desired outcome was to PUT YOUR FAITH in Person x. You may come up with two factors that are crucial in determining whether or not you should put your faith in this person. Variable A = X must be Good ANDVariable B = X must be DivineYoull note that you have made use of an AND gate - both conditions must be true for the output to be favourable.14Another example this time for the ORAchieved an AAchieved a BGoing on Trip?NoNoNopeYesYesYes!NoYesYes!YesNoYes!Your computing teacher is planning a trip to Bletchley Park. It is only, unfortunately, for the students that managed to achieve an A OR a B in their A Level Exams. What would the truth table look like?Youll note that you have made use of an OR gate - EITHER CONDITION can be true for a favourable response. 15Using truth tablesEach of the gates have a corresponding TRUTH TABLE. The truth table is an effective way of displaying the inputs and outputs of a gate using binary (Boolean values)And

ABA*BNote: The And gate is associated with multiplication????16Using truth tablesEach of the gates have a corresponding TRUTH TABLE. The truth table is an effective way of displaying the inputs and outputs of a gate using binary (Boolean values)Or

ABA+BNote: The OR gate is associated with addition????17Using truth tablesEach of the gates have a corresponding TRUTH TABLE. The truth table is an effective way of displaying the inputs and outputs of a gate using binary (Boolean values)Not

ANot A??18Using truth tablesThis is a NOT-AND gate which is equal to an AND gate followed by a NOT gate. The outputs of all NAND gates are high ifanyof the inputs are low. The symbol is an AND gate with a small circle on the output. The small circle represents inversion.

NAND

AB__AB????19Using truth tables

NORThis is a NOT-OR gate which is equal to an OR gate followed by a NOT gate. The outputs of all NOR gates are low if any of the inputs are high.The symbol is an OR gate with a small circle on the output. The small circle represents inversion

AB____A+B

????20Using truth tablesThe 'Exclusive-OR' gate is a circuit which will give a high output if either, but not both, of its two inputs are high. An encircled plus sign () is used to show the EOR operation.

XOR

AB

????21Using truth tablesThe 'Exclusive-NOR'gate circuit does the opposite to the EOR gate. It will give a low output ifeither, but not both, of its two inputs are high. The symbol is an EXOR gate with a small circle on the output. The small circle represents inversion.

XNOR

AB

????22Sample Questions

*taken with permission from OCR (Specimen paper)23Sample Questions

*taken with permission from OCR (Specimen paper)24Sample Questions

*taken with permission from OCR (Specimen paper)25Answers

*taken with permission from OCR (Specimen paper)26