1 / 18

Binary Logic

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 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

alton
Download Presentation

Binary Logic

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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 A A NOT A NOT A

  5. AND gate • Two inputs • BOTH 1 … output 1 • Otherwise output 0 A.B means A AND B A A.B B A.B B A NB. ‘AND’ means BOTH They must BOTH be true 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 + means OR A A + B B A B A OR B (or both) A + B NB CURVE

  7. Combinations of these threeeg 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) And when you get on to three inputs… Note the traditional order Note the traditional order that ensures all the options are covered Binary numbers

  8. NAND gate • An AND gate followed by a NOT gate R = A and B P = NOT R A A B B NOT (A AND B) A and B B A That little circle turns AND into NAND

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

  10. R= A AND B P = R or C C A B C A B And with three inputs… A C • (A AND B) OR C • (A OR B) AND C AB + C B C A B R = A OR B P = C AND R A (A+B)C B C • 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!

  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?

  12. And at A level… Not both • 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 A B A B B A A B A B B

  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 AND B (A.B) = A + B AND OR • 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… NOT (A AND B) NOT A NOT B (NOT A) OR (NOT B)

  15. A AND B (A.B) = A + B AND OR • We see the truth tables (final red column) are the same!!! NOT (A AND B) NOT A NOT B SAME (NOT A) OR (NOT B)

  16. A OR B (A+B) = A . B AND NOT (A OR B) OR • 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 NOT A NOT B (NOT A) AND (NOT B)

  17. A OR B (A+B) = A . B OR AND NOT (A OR B) • We see the TRUTH TABLES (final red column) are the same!!! NOT A NOT B SAME (NOT A) AND (NOT B)

  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….

More Related