Presentation is loading. Please wait.

Presentation is loading. Please wait.

Binary Logic Derrington KCL CPD/SKE 2014. Binary We’ve seen how data of all different sorts and kinds can be represented as binary bits… 0s and 1s 1 is.

Similar presentations


Presentation on theme: "Binary Logic Derrington KCL CPD/SKE 2014. Binary We’ve seen how data of all different sorts and kinds can be represented as binary bits… 0s and 1s 1 is."— Presentation transcript:

1 Binary Logic Derrington KCL CPD/SKE 2014

2 Binary We’ve seen how data of all different sorts and kinds can be represented as binary bits… 0s and 1s 1 is used to denote the TRUTH or presence of a state And 0 the FALSITY or absence of a state Now we are going to look at binary logic At how inputs in the form of 0s and 1s can be logically processed And output… again in the form of 0s and 1s Using simple circuits called LOGIC GATES

3 Switches…. Circuits 1, 0 ON, OFF TRUE, FALSE BOOLEAN Logic… invented by George BOOLE enables computers to process binary data

4 The NOT gate Very simple If a 0 is input, then the output is a 1 And if the input is a 1 then the output is a zero AP 01 10 NOT A A A

5 AND gate Two inputs BOTH 1 … output 1 Otherwise output 0 ABP 000 010 100 111 A B A AND B A.B A B NB. ‘AND’ means BOTH They must BOTH be true A.B means A AND B

6 OR gate If either or both the inputs are 1 then the output is 1 If neither of them are 1, the output is zero ABP 000 011 101 111 A + B A B NB CURVE A OR B (or both) A B A + B + means OR

7 Combinations of these three eg NAND and NOR (this is all at GCSE) When drawing the circuits and writing the truth tables for more complex combinations of these three gates.. Start with all the possible combinations of A and B (0 and 1) AB what ever 00 01 10 11 ABC 000 001 010 011 100 101 110 111 Note the traditional order that ensures all the options are covered And when you get on to three inputs… Binary number s

8 NAND gate An AND gate followed by a NOT gate ABRP 0001 0101 1001 1110 A B A and B R = A and B P = NOT R A B A B That little circle turns AND into NAND

9 NOR gate ABRP 0001 0110 1010 1110 R = A or B P = NOT R NOT A or B A B A and B A B A+B An OR gate followed by a NOT gate This little circle indicates that it’s NOT

10 And with three inputs… (A AND B) OR C (A OR B) AND C ABCRP 00000 00101 01000 01101 10000 10101 11011 11111 R= A AND BP = R or C A B C A B C A B C ABCRP 00000 00100 01010 01111 10010 10111 11010 11111 R = A OR BP = C AND R Is (A and B) and C = A and (B and C) Is (A OR B) OR C = A OR (B OR C) Draw up the truth tables and see. If two operations have the same truth table, then they must be the same: if they haven’t, they aren’t! A B C A B C AB + C (A+B)C

11 Understanding how these logic gates are used in programming It is all a way of turning decisions about input into binary….. eg a program with a REPEAT UNTIL loop REPEAT Bla bla bla UNTIL  condition A is TRUE OR  The end of the file is reached This can be seen on a TRUTH TABLE.. In fact it is the OR gate table Isn’t it? Is A TRUE? End reached? STOP NO YES NOYES AB P 000 011 101 111

12 And at A level… The exclusive OR gate EOR (one or the other but NOT both) NEOR, (an EOR gate followed by a NOT gate) Also more complicated combinations of functions and their truth tables And De Morgan’s Laws A B A B A B AB 000 011 101 110 AB 001 010 100 111 AB AB Not both

13 De Morgan’s laws These govern how we can convert Boolean expressions from one type of operation to another (A.B) = A+B (A+B) = A. B We prove these are equivalent by showing that they have the same truth tables. De Morgan’s Laws… turn ANDs into ORs and vice versa

14 (A.B) = A + B NOT (A AND B) is the same as NOT A OR NOT B To put it another way… A AND B is false if A is false OR B is false The Venn diagrams help us see it… the Truth tables PROVE it… A AND B NOT (A AND B) NOT A NOT B (NOT A) OR (NOT B) AND OR

15 (A.B) = A + B A AND B NOT (A AND B) NOT A NOT B (NOT A) OR (NOT B) AND OR We see the truth tables (final red column) are the same!!! ABA.B 0001 0101 1001 1110 ABABA+B 00111 01101 10011 11000 SAME

16 (A+B) = A. B NOT (A OR B) is the same as (NOT A) AND (NOT B) To put it another way… A OR B is false if Both A is false AND B is false Again, the Venn diagrams help us see it, but the TRUTH TABLES PROVE IT A OR B NOT (A OR B) NOT A NOT B (NOT A) AND (NOT B) OR AND

17 (A+B) = A. B We see the TRUTH TABLES (final red column) are the same!!! A OR B NOT (A OR B) NOT A NOT B (NOT A) AND (NOT B) ABABA.B 00111 01100 10010 11000 ABA+B 0001 0110 1010 1110 SAME OR AND

18 At A level (AS) Use de Morgan’s laws to simplify Boolean expressions Create truth tables from logic gates And vice versa Create logic circuits from descriptions of systems. There is a selection of worksheets and exam questions here on KEATS for you to try….


Download ppt "Binary Logic Derrington KCL CPD/SKE 2014. Binary We’ve seen how data of all different sorts and kinds can be represented as binary bits… 0s and 1s 1 is."

Similar presentations


Ads by Google