Presentation is loading. Please wait.

Presentation is loading. Please wait.

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.

Similar presentations


Presentation on theme: "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."— Presentation transcript:

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 2 x 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 rainingI have an umbrellaI wont get wet True False TrueFalse 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. ABA AND B True False TrueFalse 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 ABA OR B True FalseTrue FalseTrue 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! ANOT A TrueFalse 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 rainingI have an umbrellaI wont get wet True False True 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 rainingNOT (It is raining) I have an umbrella I wont get wet TrueFalseTrue False True FalseTrueFalseTrue 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. ABA AND B 111 100 010 000 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 ABA OR B 111 101 011 000 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! ANOT A 10 01 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 XYP 111 100 010 000 Here is the truth table for this diagram. Do you recognise it? You should because this is.... AND!!

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) XYP 110 100 010 001 X Y P

39 Computers in the real world Need help? TRUTH TABLE IT! XYX OR YP 1110 1010 0110 0001 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) ABCZ 1101 1001 0101 0000 1110 1010 0110 0010 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. ABC 110 100 010 000 111 101 011 001 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! ABCA OR B 1101 1001 0101 0000 1111 1011 0111 0010

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! ABCA OR BNOT C 11011 10011 01011 00001 11110 10110 01110 00100

46 Computers in the real world Step 4 – The result! Z = (NOT C) AND (A OR B) ABCA OR B NOT CZ 110111 100111 010111 000010 111100 101100 011100 001000

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


Download ppt "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."

Similar presentations


Ads by Google