GCSE Computing

Binary Logic

2.1.4 Candidates should be able to: (d) explain why data is represented in computer systems in binary form The logic in used in computer systems is called Boolean logic because there are only 2 possible values, TRUE or FALSE (represented in binary as 1 or 0).

Candidates should be able to: (e) understand and produce simple logic diagrams using the operations NOT, AND, OR There are several different ways to approach this topic. It is sometimes good to use them all and then you have alternative ways of explaining the logic to students if they get stuck.

Electrical circuits When the bulb lights this represents a ‘1’ as current is running through the filament. If current is not running through the filament the bulb will not light and this represents a ‘0’ (zero).

The bulb Q will only light if both switches are closed. This will allow current to flow through the bulb, illuminating the filament.

The bulb Q will light if either switch A or B is closed. This will allow current to flow through the bulb, illuminating the filament.

GCSE Computing

Binary Logic

Venn diagrams Venn diagrams are a very useful tool to demonstrate logic. You can use members of the class and subjects studied as an example. Use shaded overlapping regions to demonstrate the logic. Ask students who studies Computing, who studies Business and then who studies Computing AND Business. Students can stand up according to which subjects they take so you can use real names in the shaded areas. You can return often to this concept when students get confused with logic. Students taking computing are in set A

Students taking business studies are in set B

Students taking computing AND business studies are in the intersection of set A AND set B

Students taking computing OR business studies are in the combination of set A OR set B

Students NOT taking computing

GCSE Computing

Binary Logic

Logic Gates Encourage students to draw logic gates. They may need to label them if their drawing skills are not good. Explain that the letters are merely examples and any letters could be used. A AND B – True if and only if both A and B are true. This gate has 2 inputs and 1 output.

A OR B – True if A is true, or B is true, or both. This gate has 2 inputs and 1 output.

NOT A - True if A is false. This gate has 1 input and 1 output.

Practical exercise Use http://logic.ly/demo/ to demonstrate switching of inputs and outputs for AND/OR/NOT gates.

GCSE Computing

Binary Logic

Candidates should be able to: (f) produce a truth table from a given logic diagram. Truth Tables From the use of logic.ly students can construct a truth table for each gate where on is 1 and off is 0.

AND

OR

NOT

INPUT

OUTPUT

INPUT

OUTPUT

INPUT

OUTPUT

0

0

0

0

0

0

0

1

0

1

0

0

1

1

1

0

1

0

0

1

0

1

1

1

1

1

1

1

To produce a truth table from a logic diagram you need to work out the output(s) for every possible combination of inputs. Encourage students to write the inputs in numeric order (00,01,10,11) as they are less likely to miss a combination and can learn the patterns of the three gates as well as working out the logic.

Logic Circuits Logic circuits can be combined. Start with some simple examples. For each example work through the circuit one gate at a time from input to output working out the truth table and the Boolean algebra for each intermediate stage.

Truth Table A 0 0 1 1

B 0 1 0 1

C 0 0 0 1

Q 1 1 1 0

A 0 0 1 1

B 0 1 0 1

C 1 0 1 0

Q 0 0 1 0

Logic Diagram

Boolean Algebra

A AND B = C NOT(A AND B) = Q

NOT A = C (NOT A) AND B = Q

Encourage students to check the above circuits using logic.ly and emphasize that the truth tables are different for these circuits so the order of the gates is important.

GCSE Computing

Binary Logic

To produce a truth table from a logic diagram you need to work out the output(s) for every possible combination of inputs. If a logic diagram has only 2 inputs then there will only be 4 combinations of inputs (00, 01, 10 and 11) but 3 inputs would give 8 possible combinations and 4 inputs would give 16 combinations. For example, for the following logic diagram, there are 3 inputs, so there are 2^3 (8) combinations.

A 0 0 0 0 1 1 1 1

B 0 0 1 1 0 0 1 1

C 0 1 0 1 0 1 0 1

D 1 1 0 0 0 0 0 0

E 0 0 0 1 0 0 0 1

Q 1 1 0 1 0 0 0 1

D = NOT(A OR B) E = B AND C Q = E OR D Q = (B AND C) OR (NOT(A OR B))

This circuit adds two bits. It has 2 outputs: the sum and the carry bit. It is called a half adder. This is a very important point as it explains the purpose of learning about logic gates. They are used to build circuits that perform arithmetic in a processor. You can refer back to the PowerPoint on binary addition. http://gcsecomputing.net/wp-content/uploads/2012/01/OCR%20A451%202.1.4%20Number%20%20Binary%20Arithmetic.pps

Carry = A AND B A 0 0 1 1

B 0 1 0 1

D 0 1 1 1

E 1 1 1 0

S 0 1 1 0

C 0 0 0 1

E = NOT(A AND B) D = AOR B Sum = ( AOR B) AND ( NOT(A AND B))

Royal Institution – All very logical http://www.rigb.org/christmaslectures08/html/activities/all-very-logical.pdf#page=1

Youtube - Logic gates using toys http://www.youtube.com/watch?gl=GB&hl=en-GB&v=H-53TVR9EOw

How are logic gates made? http://www.technologystudent.com/elec1/dig2.htm

GCSE Computing

Binary Logic

Extension Students can learn about combining gates to make NAND and NOR gates: AND and NOT logic gates are combined to simulate a NAND gate.

A 0 0 1 1

B 0 1 0 1

C 0 0 0 1

Q 1 1 1 0

A NAND B

A and B are not both true.

NOT (A AND B)

A NOR B

True if neither A nor B.

NOT (A OR B)

A NAND gate with a single input becomes a NOT gate.

A

Q

0 1

1 0

NOT (A AND A) = NOT A = Q

A combination of NAND gates can be used to simulate any other gate. This is an OR gate. Many logic circuits are built entirely out of NAND gates because they are cheap to produce. This also demonstrates De Morgan’s Law.

A 0 0 1 1

B 0 1 0 1

C 1 1 0 0

D 1 0 1 0

Q 0 1 1 1

C = NOT A D = NOT B NOT(NOT A AND NOT B) = Q = A OR B

GCSE Computing

Binary Logic

OCR-A451-2.1.2-Binary-Logic-Summary.pdf

OCR-A451-2.1.2-Binary-Logic-Summary.pdf. OCR-A451-2.1.2-Binary-Logic-Summary.pdf. Open. Extract. Open with. Sign In. Main menu.

376KB Sizes 3 Downloads 148 Views

Recommend Documents

No documents