Binary Logic
OCR GCSE Computing
Starter
What is Binary Data?
Why is it important to represent data in a binary form?
Candidates should be able to:
d) explain why data is represented in computer systems in binary form
e) understand and produce simple logic diagrams using the operations NOT, AND and OR
f) produce a truth table from a given logic diagram.
Binary Logic
This is the process of using the computer to logically work through a sequence of instructions or problems
It helps the computer make a decision (output) based on a given input or inputs.
Is one OR the
other an Apple?
Apple
BananaYes
Logic Gates
There are a number of different logic gates that can be used to process data.
Thankfully we only need to know these three
AND OR NOT
Extension: Research other types of logic
gates
How they work
A logic gate accepts one or more binary inputs and produces one output.
The output will change depending on the type of gate that it is.
Look at the following slides for examples of different types of gates.
NOT
The NOT gate takes only one input and inverts it to create the output.
e.g.
If a 1 (on) value is sent as input a 0 (off) value if output as the result
0 1
AND
The AND Gate is slightly more complicated. It requires both inputs to be true (on) for the output to be true. Otherwise the output will be false (off)
0 01
000
100
111
OR
The OR Gate will produce a true (on) output whenever either or both of the input values are true (on)
0 11
000
110
111
Your goEnter the missing value from the logic gate
1
1
10
11
01
00
10
1
00
Combining Logic Gates
While useful by themselves logic gates become more useful when we join them together to create a logic diagram
01
11
How many different combinations of inputs are
there for this example?e.g. 0,0,0 0,0,1 0,1,0 0,1,1
Practical
An on/off switch (input)
And Gate
Or Gate
Not gate
Output Light
You will now attempt to create your own logic diagrams and test them to determine the output.
Goto www.neuroproductions.be/logic-lab/
Note that some diagrams look different. We will use the ones below
ActiviesCreate the diagram below and test it using the given inputs. Record the output
Both on
Top on bottom off
Both onTop on bottom off
Both off
ActivitiesCreate the diagram below and test it using the given inputs. Record the output
Both on
Top off bottom on
Both offTop on bottom off
Both on
ActivitiesCreate the diagram below and test it using the given inputs. Record the output
All onMiddle and Bottom OnTop On Bottom OnAll OffTop On
All onMiddle and Bottom OnTop On Middle OnAll Off
ActivitiesCreate the diagram below and test it using the given inputs. Record the output
All onMiddle and Bottom OnTop On Bottom OnMiddle and bottom OnAll Off
All onMiddle and Bottom OnTop On Middle OnTop OnAll Off
Activity
Draw each of the diagrams from earlier using the correct symbols
Design your own logic gates and create questions for others in the class to attempt.
Truth Tables
Another way of working out the output from a logic diagram without having to construct the circuit is by using a truth table
A truth table create a map of all of the different possible outcomes.
Note that:for one input there are two possible outcomes
for two inputs there are four possible outcomesfor three inputs there are eight possible outcomes
for four inputs there are _ _ _ _ _ _ _ possible outcomes
Truth Tables (AND)
First we want to label all of the inputs
AB
Next Create the table
A B A and B
Truth Tables (AND)
AB
Add the values For A
A B A and B
T
T
F
F
Truth Tables (AND)
AB
Add the values For B
A B A and B
T T
T F
F T
F F
Truth Tables (AND)
AB
Work out the operation. Always work from left to right if there is more than one logic gate
A B A and B
T T T
T F F
F T F
F F F
Truth Tables (OR)
First we want to label all of the inputs
AB
Next Create the table
A B A or B
Truth Tables (OR)
Add the values For A
A B A or B
T
T
F
F
AB
Truth Tables (OR)
Add the values For B
A B A or B
T T
T F
F T
F F
AB
Truth Tables (OR)
Work out the operation. Always work from left to right if there is more than one logic gate
A B A or B
T T T
T F T
F T T
F F F
AB
Truth Tables (NOT)
First we want to label all of the inputs
A
Next Create the table
A Not A
Truth Tables (NOT)
A
Add the values For A
A Not A
T
F
Truth Tables (NOT)
A
Add the values For Not A
A Not A
T F
F T
Multiple Logic GatesAB
C
A B C
Multiple Logic GatesAB
C
A B C D = A or B
Multiple Logic GatesAB
C
A B C D = A or B D and C
Multiple Logic GatesAB
C
A B C D = A or B D and C
T T T T T
T T F T F
T F T T T
T F F T F
F T T T T
F T F T F
F F T F F
F F F F F
Activities
Create truth tables for the earlier exercises
Plenary
Explain to a partner what each of the following terms means:
BinaryLogic
Truth TableLogic GateAND GateOR Gate
NOT Gate
Exam Questions