SlideShare a Scribd company logo
1 of 47
Computers in the real world
Objectives
• Understand what is meant by binary
• Why do computers use binary?
• Understand what is meant by a truth table.
• Be able to read simple logic gate circuit
diagrams
• Be able to create and append to circuit
diagrams.
Computers in the real world
Binary 1 or 0
Computer only understand binary. A binary digit can only be either 1 or
0.
By arranging 1’s and 0’s together in special ways we can create anything!
•Numbers
•Letters
•Pictures
•Music
•Software!
When you read text on a screen the computer sees
a series of 1’s and 0’s!
Computers in the real world
Why?
0 Voltage
High Voltage
Low Voltage
Computers communicate binary by setting a voltage on a wire. A high voltage
represents a 1 and a low voltage represents a 0. 0 voltage DOES NOT means a 0
binary digit! It means the line is broke!
Computers in the real world
Why?
The voltage is measured at fixed time intervals. That way a binary value can be
“read”. The value here is 10011!
Computers in the real world
Why?
What is wrong with this? Voltages sometimes fluctuate. When the values are
close together (like in the diagram below) a fluctuation could mean the difference
between a 7 being seen as a 9! As this is very common it would mean the
computer would crash MUCH more often!
0 Voltage
1
3
7
5
1
9
Computers in the real world
Why?
In order to represent two values we need two separate voltages. In a perfect
world we could have more than two voltages. The diagram below shows what a
signal along a 10 (or normal number) line may look like.
0 Voltage
1
3
7
5
1
Computers in the real world
Why?
0 Voltage
High Voltage
Low Voltage
Lets see what happens if a voltage changes in this example.
Middle Voltage
Computers in the real world
Why?
0 Voltage
High Voltage
Low Voltage
Even though it has moved it is still clearly in the low voltage area. The computer
would have no problem recognising this as a 0. Computers and binary go
together like bread and butter. Or cake and chocolate... Mmm chocolate cake 
Middle Voltage
Computers in the real world
Implications of binary
Ever wondered why computer memory has odd sizes? Like 512 Mb or
1024 Mb?
We already know computers use binary...
This means we use binary or “base 2” for sizes.
ALL sizes on computers are 2x
So the pattern will be 2,4,8,16,32,64,128,256,512,1024,4048 and so on.
Computers in the real world
Activity
Add a new section to your revision notes called binary logic. Explain
•What is binary?
•Why do computers use binary?
You are not expected to be able to convert number
or text into binary!!
Computers in the real world
Computers and logic
You may not believe this but...
Computers are logical!
Honest!
Computers in the real world
What is binary logic
Computers use binary logic to do many great things. It is one of the key
skills needed in order to be able to program a computer. It also helps to
understand why computers can be a “bit thick” sometimes. More on that
later 
Binary logic is where we say if something is either true or false. There is
no maybes or kind of. Just true or false.
For example “Is that a car?” would result in true or false. Or “Mr Hamflett
has a beard today”. Statements like “Is Mr Hamflett awesome?” would
NOT be binary logic as the answer will not be answered the same by
different people.
Computers in the real world
Predictable
Binary logic must be predictable. That means that if you asked anyone
you would always get the same true or false answer. We must be able to
predict the outcome.
It has a posh name. Binary logic is deterministic. You do not need to know
that word but it may be good way to confuse your mates!
Computers are deterministic. That means that their behaviour must be
predictable given the same input and circumstances. As I have already
said you may thing computers have a mind of their own and are NOT
predictable. I can assure you they are and there are reasons why they act
the way they do. More on that later!
Computers in the real world
Activity
Some students like to travel on trains. Not all students like cheese.
Discuss in groups which of the following statements are true based on the
statements above.
a) Students who like cheese do not like to travel on a train
b) Student who travel by train like eating cheese
c) Some students who travel by train will like cheese
d) Students who do not like cheese may still like the train.
Computers in the real world
Answers
Some students like to travel on trains. Not all students like cheese.
Discuss in groups which of the following statements are true based on the
statements above.
a) Students who like cheese do not like to travel on a train
b) Student who travel by train like eating cheese
c) Some students who travel by train will like cheese
d) Students who do not like cheese may still like the train.
Computers in the real world
Activity
Open the “understanding logic” work sheet and answer all of the
questions.
Computers in the real world
Binary operators
We can connect truth statements together by using special words. We call
these binary (or Boolean) operators.
The words we can use are –
AND
OR
NOT
By doing this we can derive something else which is true. For example -
1. It is raining
2. I have an umbrella
It is raining AND I have an umbrella means I will not get wet
Computers in the real world
Truth tables
We can consider all of the possibilities of the last statement in a little
table. This is known as a truth table.
It is raining I have an umbrella I wont get wet
True True True
True False False
False True False
False False False
The above table shows the truth for AND. Both things MUST be true for
the result to be true. But hang on there is a mistake! If it is not raining i
will not get wet either! Duh! We need to use our boolean operators to try
and fix this. Let us look at what OR and NOT do!
Computers in the real world
AND
AND – If A and B are both true then A AND B is true.
A B A AND B
True True True
True False False
False True False
False False False
Key point – Both MUST be true for AND to be true!
Computers in the real world
OR
OR– If either A or B are true then A OR B is true
A B A OR B
True True True
True False True
False True True
False False False
Key point – At least one of A or B must be true!
Computers in the real world
NOT
NOT– reverses truth. True becomes false and false becomes true!
A NOT A
True False
False True
Key point – This flips truth!
Computers in the real world
Activity
For all of these questions assume that A = True and B = false. Write down
if the result will be true or false.
1) A AND B
2) NOT B
3) NOT A
4) A OR B
5) NOT (A AND B)
Computers in the real world
Coming back to our problem
We already know there are issues with the statement below. We want the
truth below but AND / OR / NOT on their own will create it! We will need
to combine them in order to create the correct table.
It is raining I have an umbrella I wont get wet
True True True
True False False
False True True
False False True
We need to get creative to create the correct truth table!
Computers in the real world
Coming back to our problem
If we flip the raining we get the column in yellow. So rather that say true if
it is raining, we say false.
It is raining NOT (It is
raining)
I have an
umbrella
I wont get
wet
True False True True
True False False False
False True True True
False True False True
Now look at what we have. We can now use OR to get the required
answers on the left. So our final truth statement is
NOT (it is raining) OR I have an umbrella
Computers in the real world
Activity
For all of these questions assume that A = True and B = false. Write down
if the result will be true or false.
1) (NOT A) AND (NOT B)
2) NOT (A OR B)
3) (A OR B) AND (B OR A)
4) NOT (A OR B) OR (A AND B)
Once we have gone over the answers you should do the “truth table”
worksheet
Computers in the real world
Truth is a matter of on or off!
Now that we have an idea of what we mean by AND / OR / NOT we can
start looking at how truth is represented on a computer. If you do
electronics then you will already know this!
True = 1 (on)
False = 0 (off)
So rather than writing True or false we can write 1 or 0.
Let us see how this changes the truth tables.
Exam tip – You will be using 1 / 0 in the exam so get used to doing it this
way!
Computers in the real world
AND
AND – If A and B are both 1 then A AND B is 1.
A B A AND B
1 1 1
1 0 0
0 1 0
0 0 0
Key point – Both MUST be 1 for AND to be 1!
Computers in the real world
OR
OR– If either A or B are 1 then A OR B is 1
A B A OR B
1 1 1
1 0 1
0 1 1
0 0 0
Key point – At least one of A or B must be 1!
Computers in the real world
NOT
NOT– reverses truth. 1 becomes 0 and 0 becomes 1!
A NOT A
1 0
0 1
Key point – This flips truth!
Computers in the real world
Activity
Copy the truth tables into your revision notes. Make sure you copy the
ones with 1’s and 0’s!
Yes i did say copy! It does not happen very often I know! Bask in the lazy
glow!
Computers in the real world
Logic gates
Now that we have an idea of truth and understand this on / off / 1 / 0
malarkey we can move onto logic gates.
You will need to be able to read them, append to them and create them.
You will also be expected to create truth tables from them.
Below are what AND / OR and NOT look like
Computers in the real world
Remembering them!
You need to remember these symbols. Let us use some memory
techniques to help.
The OR looks a bit like a badge. There is lots
of badges to choose from but your only
allowed to wear one. So could it be that one
OR that one OR that one ....
NOT has a circle at the end which is a bit like
a full stop. You are NOT having that, full
stop!!!
AND looks a bit like a pac man ghost.
Pacman needs to eat power kills AND avoid
ghosts.
Computers in the real world
Activity
In your revision notes copy the symbols. Now think of a fun / interesting
way to remember what they look like. Note it down next to the icon.
This may seem silly but lets face it what does AND look like??? It will be
hard to remember in a years time!
Computers in the real world
Reading results off a logic gate
The diagram below has been labelled with letters. It has two Inputs and
one out put. The inputs are labelled X and Y while the output is Labelled P.
X
Y
P
What would be the output if the inputs were –
X = 1
Y = 0
P = ???
Computers in the real world
Reading results off a logic gate
X
Y
P
X Y P
1 1 1
1 0 0
0 1 0
0 0 0
Here is the truth table for this diagram.
Do you recognise it? You should because
this is....
Computers in the real world
Activity
Complete the questions below
X
Y
P
What would be the output if the inputs were –
X = 1
Y = 0
P = ???
Create the truth table for this.
Computers in the real world
Combining gates
The diagram below is P = NOT (X OR B)
X
Y
P
How? Well the output of the OR is fed into the NOT. So we do X OR Y and
then NOT it. When you want to NOT the whole of a truth statement you
need to put the NOT at the end. Even though we write it down at the
front.
Bit confusing but it will become clearer over time.
Computers in the real world
Truth table of P = NOT( X AND Y)
X Y P
1 1 0
1 0 0
0 1 0
0 0 1
X
Y
P
Computers in the real world
Need help? TRUTH TABLE IT!
X Y X OR Y P
1 1 1 0
1 0 1 0
0 1 1 0
0 0 0 1
X
Y
P
If you add a column for each stage then it will help you work out the
answer! With all these 1’s and 0’s floating around it is easy to get
confuzzled.
Computers in the real world
Activity
Create the truth table (including any help) for the logic gate diagram
below.
L
D
K
You may wish you create a extra column for the first symbol!
Computers in the real world
More that 2 inputs
It is possible to have more than 2 inputs. The diagram below shows three
inputs (A, B and C). The equation is Z = (A OR B) AND (NOT C)
A
B
Z
You can create truth tables for these beasts as well!
C
Computers in the real world
More that 2 inputs
It is possible to have more than 2 inputs. The diagram below shows three
inputs (A, B and C). The equation is Z = (A OR B) AND (NOT C)
A B C Z
1 1 0 1
1 0 0 1
0 1 0 1
0 0 0 0
1 1 1 0
1 0 1 0
0 1 1 0
0 0 1 0
So how did I make this? I will
take you through the steps
Computers in the real world
Step 1 – Write out all the permutations
The first step is write down all of the possibilities. As there are now 3
inputs there are extra rows.
A B C
1 1 0
1 0 0
0 1 0
0 0 0
1 1 1
1 0 1
0 1 1
0 0 1
Every possibility must be
written down. As a rule of
thumb
1 input = 2 rows
2 inputs = 4 rows
3 inputs = 8 rows
4 inputs = 16 rows..
They double each time!
As a tip. When you add a extra
output copy all of the rows and
then add 0’s in the new input
for the first half and 1’s for the
second half.
Computers in the real world
Step 2 – Perform the first logic gate
Now we create a new column for the first logic gate. That will help us
work out the output of that gate. This will then be the input to the next!
A B C A OR B
1 1 0 1
1 0 0 1
0 1 0 1
0 0 0 0
1 1 1 1
1 0 1 1
0 1 1 1
0 0 1 0
Computers in the real world
Step 3 – Do the same for the next logic gate
We just add a new column for each logic gate. Things are starting to take
shape!
A B C A OR B NOT C
1 1 0 1 1
1 0 0 1 1
0 1 0 1 1
0 0 0 0 1
1 1 1 1 0
1 0 1 1 0
0 1 1 1 0
0 0 1 0 0
Computers in the real world
Step 4 – The result!
Z = (NOT C) AND (A OR B)
A B C A OR
B
NOT C Z
1 1 0 1 1 1
1 0 0 1 1 1
0 1 0 1 1 1
0 0 0 0 1 0
1 1 1 1 0 0
1 0 1 1 0 0
0 1 1 1 0 0
0 0 1 0 0 0
Computers in the real world
Activity
Write down the equation related to this diagram and then create a truth
table.
L
D
K
The key to success here is HOW you do it, not the answer!
A

More Related Content

Similar to binary_logic.pptx

Electricity that loves
Electricity that loves Electricity that loves
Electricity that loves Eficode
 
How To Run a 5 Whys (With Humans, Not Robots)
How To Run a 5 Whys (With Humans, Not Robots)How To Run a 5 Whys (With Humans, Not Robots)
How To Run a 5 Whys (With Humans, Not Robots)Dan Milstein
 
Lesson4.2 u4 l1 binary squences
Lesson4.2 u4 l1 binary squencesLesson4.2 u4 l1 binary squences
Lesson4.2 u4 l1 binary squencesLexume1
 
Spreadsheets for developers
Spreadsheets for developersSpreadsheets for developers
Spreadsheets for developersFelienne Hermans
 
DEF CON 27 - workshop - EIGENTOURIST - hacking with monads
DEF CON 27 - workshop - EIGENTOURIST - hacking with monadsDEF CON 27 - workshop - EIGENTOURIST - hacking with monads
DEF CON 27 - workshop - EIGENTOURIST - hacking with monadsFelipe Prado
 
A black box gift for x-mas
A black box gift for x-masA black box gift for x-mas
A black box gift for x-masAke Hedman
 
Introduction to programming
Introduction to programmingIntroduction to programming
Introduction to programmingAndre Leal
 
Spreadsheets are graphs too: Using Neo4J as backend to store spreadsheet info...
Spreadsheets are graphs too: Using Neo4J as backend to store spreadsheet info...Spreadsheets are graphs too: Using Neo4J as backend to store spreadsheet info...
Spreadsheets are graphs too: Using Neo4J as backend to store spreadsheet info...Felienne Hermans
 
CPAP.com Introduction to Coding: Part 1
CPAP.com Introduction to Coding: Part 1CPAP.com Introduction to Coding: Part 1
CPAP.com Introduction to Coding: Part 1johnnygoodman
 
Basic Symbolic Computation in Perl
Basic Symbolic Computation in PerlBasic Symbolic Computation in Perl
Basic Symbolic Computation in PerlMike Friedman
 
Silverdisappointing8 120924091642-phpapp01
Silverdisappointing8 120924091642-phpapp01Silverdisappointing8 120924091642-phpapp01
Silverdisappointing8 120924091642-phpapp01David Robles
 
Disappointing results & open problems in Monte-Carlo Tree Search
Disappointing results & open problems in Monte-Carlo Tree SearchDisappointing results & open problems in Monte-Carlo Tree Search
Disappointing results & open problems in Monte-Carlo Tree SearchOlivier Teytaud
 
How to Run a Post-Mortem (With Humans, Not Robots), Velocity 2013
How to Run a Post-Mortem (With Humans, Not Robots), Velocity 2013How to Run a Post-Mortem (With Humans, Not Robots), Velocity 2013
How to Run a Post-Mortem (With Humans, Not Robots), Velocity 2013Dan Milstein
 
Human computer interaction
Human computer interactionHuman computer interaction
Human computer interactionemaan waseem
 
Bavpwjs1113
Bavpwjs1113Bavpwjs1113
Bavpwjs1113Thinkful
 
The Biological Imperative for Intelligent Content
The Biological Imperative for Intelligent ContentThe Biological Imperative for Intelligent Content
The Biological Imperative for Intelligent ContentNoz Urbina
 

Similar to binary_logic.pptx (20)

Introduction toprogramming
Introduction toprogrammingIntroduction toprogramming
Introduction toprogramming
 
Electricity that loves
Electricity that loves Electricity that loves
Electricity that loves
 
ICT for teachers
ICT for teachersICT for teachers
ICT for teachers
 
How To Run a 5 Whys (With Humans, Not Robots)
How To Run a 5 Whys (With Humans, Not Robots)How To Run a 5 Whys (With Humans, Not Robots)
How To Run a 5 Whys (With Humans, Not Robots)
 
Lesson4.2 u4 l1 binary squences
Lesson4.2 u4 l1 binary squencesLesson4.2 u4 l1 binary squences
Lesson4.2 u4 l1 binary squences
 
Spreadsheets for developers
Spreadsheets for developersSpreadsheets for developers
Spreadsheets for developers
 
DEF CON 27 - workshop - EIGENTOURIST - hacking with monads
DEF CON 27 - workshop - EIGENTOURIST - hacking with monadsDEF CON 27 - workshop - EIGENTOURIST - hacking with monads
DEF CON 27 - workshop - EIGENTOURIST - hacking with monads
 
A black box gift for x-mas
A black box gift for x-masA black box gift for x-mas
A black box gift for x-mas
 
Introduction to programming
Introduction to programmingIntroduction to programming
Introduction to programming
 
Spreadsheets are graphs too: Using Neo4J as backend to store spreadsheet info...
Spreadsheets are graphs too: Using Neo4J as backend to store spreadsheet info...Spreadsheets are graphs too: Using Neo4J as backend to store spreadsheet info...
Spreadsheets are graphs too: Using Neo4J as backend to store spreadsheet info...
 
CPAP.com Introduction to Coding: Part 1
CPAP.com Introduction to Coding: Part 1CPAP.com Introduction to Coding: Part 1
CPAP.com Introduction to Coding: Part 1
 
Lab a
Lab aLab a
Lab a
 
Basic Symbolic Computation in Perl
Basic Symbolic Computation in PerlBasic Symbolic Computation in Perl
Basic Symbolic Computation in Perl
 
Silverdisappointing8 120924091642-phpapp01
Silverdisappointing8 120924091642-phpapp01Silverdisappointing8 120924091642-phpapp01
Silverdisappointing8 120924091642-phpapp01
 
Disappointing results & open problems in Monte-Carlo Tree Search
Disappointing results & open problems in Monte-Carlo Tree SearchDisappointing results & open problems in Monte-Carlo Tree Search
Disappointing results & open problems in Monte-Carlo Tree Search
 
C programming guide new
C programming guide newC programming guide new
C programming guide new
 
How to Run a Post-Mortem (With Humans, Not Robots), Velocity 2013
How to Run a Post-Mortem (With Humans, Not Robots), Velocity 2013How to Run a Post-Mortem (With Humans, Not Robots), Velocity 2013
How to Run a Post-Mortem (With Humans, Not Robots), Velocity 2013
 
Human computer interaction
Human computer interactionHuman computer interaction
Human computer interaction
 
Bavpwjs1113
Bavpwjs1113Bavpwjs1113
Bavpwjs1113
 
The Biological Imperative for Intelligent Content
The Biological Imperative for Intelligent ContentThe Biological Imperative for Intelligent Content
The Biological Imperative for Intelligent Content
 

Recently uploaded

ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxPooja Bhuva
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...Amil baba
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 

Recently uploaded (20)

ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 

binary_logic.pptx

  • 1. Computers in the real world Objectives • Understand what is meant by binary • Why do computers use binary? • Understand what is meant by a truth table. • Be able to read simple logic gate circuit diagrams • Be able to create and append to circuit diagrams.
  • 2. Computers in the real world Binary 1 or 0 Computer only understand binary. A binary digit can only be either 1 or 0. By arranging 1’s and 0’s together in special ways we can create anything! •Numbers •Letters •Pictures •Music •Software! When you read text on a screen the computer sees a series of 1’s and 0’s!
  • 3. Computers in the real world Why? 0 Voltage High Voltage Low Voltage Computers communicate binary by setting a voltage on a wire. A high voltage represents a 1 and a low voltage represents a 0. 0 voltage DOES NOT means a 0 binary digit! It means the line is broke!
  • 4. Computers in the real world Why? The voltage is measured at fixed time intervals. That way a binary value can be “read”. The value here is 10011!
  • 5. Computers in the real world Why? What is wrong with this? Voltages sometimes fluctuate. When the values are close together (like in the diagram below) a fluctuation could mean the difference between a 7 being seen as a 9! As this is very common it would mean the computer would crash MUCH more often! 0 Voltage 1 3 7 5 1 9
  • 6. Computers in the real world Why? In order to represent two values we need two separate voltages. In a perfect world we could have more than two voltages. The diagram below shows what a signal along a 10 (or normal number) line may look like. 0 Voltage 1 3 7 5 1
  • 7. Computers in the real world Why? 0 Voltage High Voltage Low Voltage Lets see what happens if a voltage changes in this example. Middle Voltage
  • 8. Computers in the real world Why? 0 Voltage High Voltage Low Voltage Even though it has moved it is still clearly in the low voltage area. The computer would have no problem recognising this as a 0. Computers and binary go together like bread and butter. Or cake and chocolate... Mmm chocolate cake  Middle Voltage
  • 9. Computers in the real world Implications of binary Ever wondered why computer memory has odd sizes? Like 512 Mb or 1024 Mb? We already know computers use binary... This means we use binary or “base 2” for sizes. ALL sizes on computers are 2x So the pattern will be 2,4,8,16,32,64,128,256,512,1024,4048 and so on.
  • 10. Computers in the real world Activity Add a new section to your revision notes called binary logic. Explain •What is binary? •Why do computers use binary? You are not expected to be able to convert number or text into binary!!
  • 11. Computers in the real world Computers and logic You may not believe this but... Computers are logical! Honest!
  • 12. Computers in the real world What is binary logic Computers use binary logic to do many great things. It is one of the key skills needed in order to be able to program a computer. It also helps to understand why computers can be a “bit thick” sometimes. More on that later  Binary logic is where we say if something is either true or false. There is no maybes or kind of. Just true or false. For example “Is that a car?” would result in true or false. Or “Mr Hamflett has a beard today”. Statements like “Is Mr Hamflett awesome?” would NOT be binary logic as the answer will not be answered the same by different people.
  • 13. Computers in the real world Predictable Binary logic must be predictable. That means that if you asked anyone you would always get the same true or false answer. We must be able to predict the outcome. It has a posh name. Binary logic is deterministic. You do not need to know that word but it may be good way to confuse your mates! Computers are deterministic. That means that their behaviour must be predictable given the same input and circumstances. As I have already said you may thing computers have a mind of their own and are NOT predictable. I can assure you they are and there are reasons why they act the way they do. More on that later!
  • 14. Computers in the real world Activity Some students like to travel on trains. Not all students like cheese. Discuss in groups which of the following statements are true based on the statements above. a) Students who like cheese do not like to travel on a train b) Student who travel by train like eating cheese c) Some students who travel by train will like cheese d) Students who do not like cheese may still like the train.
  • 15. Computers in the real world Answers Some students like to travel on trains. Not all students like cheese. Discuss in groups which of the following statements are true based on the statements above. a) Students who like cheese do not like to travel on a train b) Student who travel by train like eating cheese c) Some students who travel by train will like cheese d) Students who do not like cheese may still like the train.
  • 16. Computers in the real world Activity Open the “understanding logic” work sheet and answer all of the questions.
  • 17. Computers in the real world Binary operators We can connect truth statements together by using special words. We call these binary (or Boolean) operators. The words we can use are – AND OR NOT By doing this we can derive something else which is true. For example - 1. It is raining 2. I have an umbrella It is raining AND I have an umbrella means I will not get wet
  • 18. Computers in the real world Truth tables We can consider all of the possibilities of the last statement in a little table. This is known as a truth table. It is raining I have an umbrella I wont get wet True True True True False False False True False False False False The above table shows the truth for AND. Both things MUST be true for the result to be true. But hang on there is a mistake! If it is not raining i will not get wet either! Duh! We need to use our boolean operators to try and fix this. Let us look at what OR and NOT do!
  • 19. Computers in the real world AND AND – If A and B are both true then A AND B is true. A B A AND B True True True True False False False True False False False False Key point – Both MUST be true for AND to be true!
  • 20. Computers in the real world OR OR– If either A or B are true then A OR B is true A B A OR B True True True True False True False True True False False False Key point – At least one of A or B must be true!
  • 21. Computers in the real world NOT NOT– reverses truth. True becomes false and false becomes true! A NOT A True False False True Key point – This flips truth!
  • 22. Computers in the real world Activity For all of these questions assume that A = True and B = false. Write down if the result will be true or false. 1) A AND B 2) NOT B 3) NOT A 4) A OR B 5) NOT (A AND B)
  • 23. Computers in the real world Coming back to our problem We already know there are issues with the statement below. We want the truth below but AND / OR / NOT on their own will create it! We will need to combine them in order to create the correct table. It is raining I have an umbrella I wont get wet True True True True False False False True True False False True We need to get creative to create the correct truth table!
  • 24. Computers in the real world Coming back to our problem If we flip the raining we get the column in yellow. So rather that say true if it is raining, we say false. It is raining NOT (It is raining) I have an umbrella I wont get wet True False True True True False False False False True True True False True False True Now look at what we have. We can now use OR to get the required answers on the left. So our final truth statement is NOT (it is raining) OR I have an umbrella
  • 25. Computers in the real world Activity For all of these questions assume that A = True and B = false. Write down if the result will be true or false. 1) (NOT A) AND (NOT B) 2) NOT (A OR B) 3) (A OR B) AND (B OR A) 4) NOT (A OR B) OR (A AND B) Once we have gone over the answers you should do the “truth table” worksheet
  • 26. Computers in the real world Truth is a matter of on or off! Now that we have an idea of what we mean by AND / OR / NOT we can start looking at how truth is represented on a computer. If you do electronics then you will already know this! True = 1 (on) False = 0 (off) So rather than writing True or false we can write 1 or 0. Let us see how this changes the truth tables. Exam tip – You will be using 1 / 0 in the exam so get used to doing it this way!
  • 27. Computers in the real world AND AND – If A and B are both 1 then A AND B is 1. A B A AND B 1 1 1 1 0 0 0 1 0 0 0 0 Key point – Both MUST be 1 for AND to be 1!
  • 28. Computers in the real world OR OR– If either A or B are 1 then A OR B is 1 A B A OR B 1 1 1 1 0 1 0 1 1 0 0 0 Key point – At least one of A or B must be 1!
  • 29. Computers in the real world NOT NOT– reverses truth. 1 becomes 0 and 0 becomes 1! A NOT A 1 0 0 1 Key point – This flips truth!
  • 30. Computers in the real world Activity Copy the truth tables into your revision notes. Make sure you copy the ones with 1’s and 0’s! Yes i did say copy! It does not happen very often I know! Bask in the lazy glow!
  • 31. Computers in the real world Logic gates Now that we have an idea of truth and understand this on / off / 1 / 0 malarkey we can move onto logic gates. You will need to be able to read them, append to them and create them. You will also be expected to create truth tables from them. Below are what AND / OR and NOT look like
  • 32. Computers in the real world Remembering them! You need to remember these symbols. Let us use some memory techniques to help. The OR looks a bit like a badge. There is lots of badges to choose from but your only allowed to wear one. So could it be that one OR that one OR that one .... NOT has a circle at the end which is a bit like a full stop. You are NOT having that, full stop!!! AND looks a bit like a pac man ghost. Pacman needs to eat power kills AND avoid ghosts.
  • 33. Computers in the real world Activity In your revision notes copy the symbols. Now think of a fun / interesting way to remember what they look like. Note it down next to the icon. This may seem silly but lets face it what does AND look like??? It will be hard to remember in a years time!
  • 34. Computers in the real world Reading results off a logic gate The diagram below has been labelled with letters. It has two Inputs and one out put. The inputs are labelled X and Y while the output is Labelled P. X Y P What would be the output if the inputs were – X = 1 Y = 0 P = ???
  • 35. Computers in the real world Reading results off a logic gate X Y P X Y P 1 1 1 1 0 0 0 1 0 0 0 0 Here is the truth table for this diagram. Do you recognise it? You should because this is....
  • 36. Computers in the real world Activity Complete the questions below X Y P What would be the output if the inputs were – X = 1 Y = 0 P = ??? Create the truth table for this.
  • 37. Computers in the real world Combining gates The diagram below is P = NOT (X OR B) X Y P How? Well the output of the OR is fed into the NOT. So we do X OR Y and then NOT it. When you want to NOT the whole of a truth statement you need to put the NOT at the end. Even though we write it down at the front. Bit confusing but it will become clearer over time.
  • 38. Computers in the real world Truth table of P = NOT( X AND Y) X Y P 1 1 0 1 0 0 0 1 0 0 0 1 X Y P
  • 39. Computers in the real world Need help? TRUTH TABLE IT! X Y X OR Y P 1 1 1 0 1 0 1 0 0 1 1 0 0 0 0 1 X Y P If you add a column for each stage then it will help you work out the answer! With all these 1’s and 0’s floating around it is easy to get confuzzled.
  • 40. Computers in the real world Activity Create the truth table (including any help) for the logic gate diagram below. L D K You may wish you create a extra column for the first symbol!
  • 41. Computers in the real world More that 2 inputs It is possible to have more than 2 inputs. The diagram below shows three inputs (A, B and C). The equation is Z = (A OR B) AND (NOT C) A B Z You can create truth tables for these beasts as well! C
  • 42. Computers in the real world More that 2 inputs It is possible to have more than 2 inputs. The diagram below shows three inputs (A, B and C). The equation is Z = (A OR B) AND (NOT C) A B C Z 1 1 0 1 1 0 0 1 0 1 0 1 0 0 0 0 1 1 1 0 1 0 1 0 0 1 1 0 0 0 1 0 So how did I make this? I will take you through the steps
  • 43. Computers in the real world Step 1 – Write out all the permutations The first step is write down all of the possibilities. As there are now 3 inputs there are extra rows. A B C 1 1 0 1 0 0 0 1 0 0 0 0 1 1 1 1 0 1 0 1 1 0 0 1 Every possibility must be written down. As a rule of thumb 1 input = 2 rows 2 inputs = 4 rows 3 inputs = 8 rows 4 inputs = 16 rows.. They double each time! As a tip. When you add a extra output copy all of the rows and then add 0’s in the new input for the first half and 1’s for the second half.
  • 44. Computers in the real world Step 2 – Perform the first logic gate Now we create a new column for the first logic gate. That will help us work out the output of that gate. This will then be the input to the next! A B C A OR B 1 1 0 1 1 0 0 1 0 1 0 1 0 0 0 0 1 1 1 1 1 0 1 1 0 1 1 1 0 0 1 0
  • 45. Computers in the real world Step 3 – Do the same for the next logic gate We just add a new column for each logic gate. Things are starting to take shape! A B C A OR B NOT C 1 1 0 1 1 1 0 0 1 1 0 1 0 1 1 0 0 0 0 1 1 1 1 1 0 1 0 1 1 0 0 1 1 1 0 0 0 1 0 0
  • 46. Computers in the real world Step 4 – The result! Z = (NOT C) AND (A OR B) A B C A OR B NOT C Z 1 1 0 1 1 1 1 0 0 1 1 1 0 1 0 1 1 1 0 0 0 0 1 0 1 1 1 1 0 0 1 0 1 1 0 0 0 1 1 1 0 0 0 0 1 0 0 0
  • 47. Computers in the real world Activity Write down the equation related to this diagram and then create a truth table. L D K The key to success here is HOW you do it, not the answer! A