470 likes | 543 Views
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.
E N D
Computers in the real worldObjectives • 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 worldBinary 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 worldWhy? High Voltage Low Voltage 0 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 worldWhy? 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 worldWhy? 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! 9 7 5 3 1 1 0 Voltage
Computers in the real worldWhy? 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. 7 5 3 1 1 0 Voltage
Computers in the real worldWhy? High Voltage Middle Voltage Low Voltage 0 Voltage Lets see what happens if a voltage changes in this example.
Computers in the real worldWhy? High Voltage Middle Voltage Low Voltage 0 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
Computers in the real worldImplications 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 worldActivity • 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 worldComputers and logic You may not believe this but... Computers are logical! Honest!
Computers in the real worldWhat 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 worldPredictable 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 worldActivity 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. Students who like cheese do not like to travel on a train Student who travel by train like eating cheese Some students who travel by train will like cheese Students who do not like cheese may still like the train.
Computers in the real worldAnswers 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. Students who like cheese do not like to travel on a train Student who travel by train like eating cheese Some students who travel by train will like cheese Students who do not like cheese may still like the train.
Computers in the real worldActivity Open the “understanding logic” work sheet and answer all of the questions.
Computers in the real worldBinary 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 - It is raining I have an umbrella It is raining AND I have an umbrella means I will not get wet
Computers in the real worldTruth tables We can consider all of the possibilities of the last statement in a little table. This is known as a truth table. 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 worldAND AND – If A and B are both true then A AND B is true. Key point – Both MUST be true for AND to be true!
Computers in the real worldOR OR– If either A or B are true then A OR B is true Key point – At least one of A or B must be true!
Computers in the real worldNOT NOT– reverses truth. True becomes false and false becomes true! Key point – This flips truth!
Computers in the real worldActivity For all of these questions assume that A = True and B = false. Write down if the result will be true or false. A AND B NOT B NOT A A OR B NOT (A AND B)
Computers in the real worldComing 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. We need to get creative to create the correct truth table!
Computers in the real worldComing 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. 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 worldActivity For all of these questions assume that A = True and B = false. Write down if the result will be true or false. (NOT A) AND (NOT B) NOT (A OR B) (A OR B) AND (B OR A) 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 worldTruth 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 worldAND AND – If A and B are both 1 then A AND B is 1. Key point – Both MUST be 1 for AND to be 1!
Computers in the real worldOR OR– If either A or B are 1 then A OR B is 1 Key point – At least one of A or B must be 1!
Computers in the real worldNOT NOT– reverses truth. 1 becomes 0 and 0 becomes 1! Key point – This flips truth!
Computers in the real worldActivity 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 worldLogic 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 worldRemembering 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 worldActivity 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 worldReading 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 P Y What would be the output if the inputs were – X = 1 Y = 0 P = ???
Computers in the real worldReading results off a logic gate AND!! X Here is the truth table for this diagram. Do you recognise it? You should because this is.... P Y
Computers in the real worldActivity Complete the questions below X P Y What would be the output if the inputs were – X = 1 Y = 0 P = ??? Create the truth table for this.
Computers in the real worldCombining gates The diagram below is P = NOT (X OR B) X P Y 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 worldTruth table of P = NOT( X AND Y) X P Y
Computers in the real worldNeed help? TRUTH TABLE IT! X P Y 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 worldActivity Create the truth table (including any help) for the logic gate diagram below. L K D You may wish you create a extra column for the first symbol!
Computers in the real worldMore 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 C You can create truth tables for these beasts as well!
Computers in the real worldMore 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) So how did I make this? I will take you through the steps
Computers in the real worldStep 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. 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 worldStep 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!
Computers in the real worldStep 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!
Computers in the real worldStep 4 – The result! Z = (NOT C) AND (A OR B)
Computers in the real worldActivity Write down the equation related to this diagram and then create a truth table. L D K A The key to success here is HOW you do it, not the answer!