Convert the following binary numbers to denary. Show your working: 00011010 10011101 0010001 00001111 2 Starter activity Conversion between number bases Explorer task Why do computers use the binary number system? Convert the following denary numbers to binary. Show your working: 5. 5 6. 24 7. 99 8. 72
Convert the following denary numbers to binary. Show your working: 26 157 17 15 3 Starter activity Answers: Conversion between number bases Convert the following binary numbers to denary. Show your working: 5. 0101 6. 11000 7. 1100011 8. 1001000 Computers use voltages to represent data. Having a voltage on or off is the most accurate way to represent values. Explorer task
In this lesson, you will: Discover the logic gates AND, NOT, and OR, including their symbols and truth tables Describe how logic gates are used in carrying out computation Design a logical circuit, combining logic gates to solve a problem Lesson 10: Logic gates 4 Objectives
George Boole was an English mathematician who lived in the 1800s. In 1847 he wrote a book called The Mathematical Analysis of Logic , in which he introduced Boolean algebra which used the logical states of True or False. All very logical! Activity 1
Later in 1940 Claude Shannon discovered that Boolean algebra could be applied to electrical circuits . The True and False values could also be represented as 1 and 0. Shannon’s discovery forms the basis of all electronic computers. All very logical! Activity 1
All computers have a central processing unit (CPU). The CPU processes the data and instructions for the computer. This processing uses billions of tiny electronic components to carry out operations called logic gates. All very logical! Activity 1
Logic gates use Boolean logic to take one or more inputs and produce a single output . We use symbols to represent these gates in a circuit. All very logical! Activity 1
There are three fundamental logic gates. These are AND , OR , and NOT . The three fundamental gates Activity 1 AND OR NOT
Logic gates switch on and off, depending on the input that has been provided and the type of gate being used. All very logical! Activity 1 False False False
If the inputs evaluate to True, then an electrical current will flow through the gate. The gate will be switched on . All very logical! Activity 1 True True True
If the inputs evaluate to False, then the electrical current will be stopped. The gate will be switched off . All very logical! Activity 1 False True False
Open the ‘Logic gates’ worksheet. There is space for you to make notes as we go through the three fundamental gates. The three fundamental gates. Activity 2
This is because the condition can only be True if both expressions evaluate as True . The three fundamental gates: AND Activity 2 person <- “Sam” known <- True IF person = “Sam” AND known = True THEN OUTPUT “hello” ELSE OUTPUT “” END IF Here is an example of the logic operator AND used in pseudocode. . Answer . hello Question . What will be the output of this program when it is executed?
The AND logic gate takes two inputs. The three fundamental gates: AND Activity 2 inputs output All logic gates have a single output.
An AND gate will only output as True (switch on) if both inputs are True . The three fundamental gates: AND Activity 2 True True True
True and False can also be represented by a 1 and a . The three fundamental gates: AND Activity 2 1 1 1
If any of the inputs are False , the AND gate also outputs Fals e. The three fundamental gates: AND Activity 2 False True False
If any of the inputs are , the AND gate also outputs . The three fundamental gates: AND Activity 2 1
In order to keep track of the possible outputs of a logic gate, you can use a truth table . Truth table: AND Activity 2 Inputs Output A B Q
Labels can be given to the inputs and outputs to make this easier to transpose. Truth table: AND Activity 2 Inputs Output A B Q Q A B
Labels can be given to the inputs and outputs to make this easier to transpose. Truth table: AND Activity 2 Inputs Output A B Q Q A B
All possible input combinations are then entered into the truth table . Notice the order in which the values are entered: 0, 1, 2, 3. Truth table: AND Activity 2 Inputs Output A B Q 1 1 1 1
Question . If both inputs are / False , then what would the output be? Truth table: AND Activity 2 Inputs Output A B Q ? 1 1 1 1
Answer . Truth table: AND Activity 2 Inputs Output A B Q 1 1 1 1
Question . If A is False and B is True , what will the output be? Truth table: AND Activity 2 Inputs Output A B Q 1 ? 1 1 1
Answer . Truth table: AND Activity 2 Inputs Output A B Q 1 1 1 1
Question . If A is True and B is False , what will the output be? Truth table: AND Activity 2 Inputs Output A B Q 1 1 ? 1 1
Answer . Truth table: AND Activity 2 Inputs Output A B Q 1 1 1 1
Question . If A is True and B is True , what will the output be? Truth table: AND Activity 2 Inputs Output A B Q 1 1 1 1 ?
Answer . Truth table: AND Activity 2 Inputs Output A B Q 1 1 1 1 1
This is now a completed truth table for the AND gate. On your ‘Logic gates’ worksheet , copy over the output for the AND gate. Truth table: AND Activity 2 Inputs Output A B Q 1 1 1 1 1
This is an OR gate. An OR gate will output as True if one or both inputs are True . The three fundamental gates: OR Activity 2 True True False
Here is an example of the logic operator OR being used in pseudocode. Question . What will be the output of this program when it is executed? The three fundamental gates: OR Activity 2 person <- “Ajay” known <- False IF person = “Ajay” OR known = True THEN OUTPUT “hello” ELSE OUTPUT “” END IF
Answer . hello The three fundamental gates: OR Activity 2 person <- “Ajay” known <- False IF person = “Ajay” OR known = True THEN OUTPUT “hello” ELSE OUTPUT “” END IF
This is because the condition will be True if one or both of the expressions are True . The three fundamental gates: OR Activity 2 person <- “Ajay” known <- False IF person = “Ajay” OR known = True THEN OUTPUT “hello” ELSE OUTPUT “” END IF
Here is a truth table for the OR gate. Truth table: OR Activity 2 Inputs Output A B Q 1 1 1 1 Q A B
Complete the OR truth table on your worksheet. Remember that an OR gate will output as True if one or both inputs are True . Truth table: OR Activity 2 Inputs Output A B Q 1 1 1 1
Answer . Truth table: OR Activity 2 Inputs Output A B Q 1 1 1 1 1 1 1
This is a NOT gate. A NOT gate only has 1 input and 1 output. The output is always the opposite of the input. NOT gates are often referred to as inverters . The three fundamental gates: NOT Activity 2 True False
Here is a truth table for the NOT gate. Truth table: NOT Activity 2 Input Output A Q 1 Q A
Complete the NOT truth table on your worksheet. Truth table: NOT Activity 2 Input Output A Q 1 Q A
Answer . Truth table: NOT Activity 2 Input Output A Q 1 1
“My security system will trigger if it is night-time and it detects movement.” Putting it all together Identify the inputs in the expression Activity 3
“My security system will trigger if it is night-time and it detects movement .” Putting it all together Identify the inputs in the expression Activity 3
“My security system will trigger if it is night-time and it detects movement.” Putting it all together Identify the inputs in the expression Identify the output Activity 3
“My security system will trigger if it is night-time and it detects movement.” Putting it all together Identify the inputs in the expression Identify the output Activity 3
“My security system will trigger if it is night-time and it detects movement.” Putting it all together Identify the inputs in the expression Identify the output Identify the logical operator Activity 3
“My security system will trigger if it is night-time and it detects movement.” Putting it all together Identify the inputs in the expression Identify the output Identify the logical operator Activity 3
“My security system will trigger if it is night-time and it detects movement .” Putting it all together Identify the inputs in the expression Identify the output Identify the logical operator Draw the logical diagram Activity 3
“My security system will trigger if it is night-time and it detects movement .” Putting it all together Identify the inputs in the expression Identify the output Identify the logical operator Draw the logical diagram Activity 3 alarm night movement
“My security system will trigger if it is night-time and it detects movement .” Putting it all together Identify the inputs in the expression Identify the output Identify the logical operator Draw the logical diagram Create the truth table Activity 3
“My security system will trigger if it is night-time and it detects movement .” Putting it all together Identify the inputs in the expression Identify the output Identify the logical operator Draw the logical diagram Create the truth table Activity 3 Inputs Output A B Q 1 1 1 1 1
Use the ‘Putting it all together’ worksheet to turn the statements into logic circuits with a truth table. Activity: Putting it all together Activity 2
“The light will turn on if the switch is turned or if I clap.” Solutions: Putting it all together Plenary Inputs Output A B Q 1 1 1 1 1 1 1 light switch clap
“The buzzer will not turn on if the battery is charged.” Solutions: Putting it all together Plenary Input Output A Q 1 1 buzzer charge
“The plants will be watered if it is hot and the soil is dry.” Solutions: Putting it all together Plenary Inputs Output A B Q 1 1 1 1 1 water hot dry soil
In this lesson, you… Learnt that processors are made of logic gates Learnt about the AND, NOT, and OR gates Next lesson 58 Next lesson, you will… Learn about three input logical circuits that use a combination of gates Learn how to write a logical expression Summary