Download presentation
Presentation is loading. Please wait.
Published byAllen Cox Modified over 6 years ago
1
Logic Gates Practical Objective: to develop an understanding of logic circuits and truth tables.
2
Binary Humans count using the decimal (aka denary) number system. Computers count using the binary number system as it can represent the two states of an electronic circuit. On = 1 Off = 0
3
Logic Gates Logic gates are the fundamental building blocks of digital circuits. There are three main logic gates: NOT AND OR Each logic gate is represented by a different symbol.
4
Activity 1 In pairs, look at the program below and write out what you think might happen when it runs on a micro:bit: What would you expect the micro:bit to do?
5
Activity 2 Working in pairs, download and flash the starter program onto one of your micro:bits and create the circuit shown in the diagram below (make sure the micro:bit is connected to a USB port):
6
Activity 3 In pairs answer the following questions: Question Answer
Give an example of how selection is used in the starter program. What happens to the LED when switch is in the OFF position? What happens to the LED when switch is in the ON position?
7
Activity 4a We use truth tables to show all the different possible states of a logic circuit. This is a partially complete truth table for a NOT gate logic circuit. It shows all the possible inputs. Use your logic circuit to help you fill in the outputs (LED ON = 1, LED OFF = 0). Input Output 1
8
Activity 4b Working in your pair, divide the following tasks between you and complete them: Task 1: Adapt the starter program to simulate an AND gate. Ensure you update the symbol that displays on the micro:bit. The AND gate outputs a 1 if both inputs are 1. Symbol: Task 2: Adapt the starter program to simulate an OR gate. Ensure you update the symbol that displays on the micro:bit. The OR gate outputs a 1 if either or both inputs are 1. Symbol: Hint: These gates have two inputs instead of one, you will need to use pin 1 for the second input. In the NOT gate program we checked only pin 0, in this program you will need to check both pin 0 and pin 1.
9
Activity 4c Flash your micro:bits with your new programs and create the circuit shown below with the micro:bit that has the AND gate program:
10
Activity 4d Use your new circuit to help you complete this truth table: AND Input 1 Input 2 Output 1
11
Activity 4e Change the micro:bit in your circuit to the one containing the OR gate program. Use the circuit to help you complete this truth table: OR Input 1 Input 2 Output 1
12
Challenge Create a new program that lets the user select which logic gate they want to use by pressing the buttons on the micro:bit: Button A = NOT Button B = AND Buttons A + B = OR Hint: The code below shows you how to check whether a button has been pressed:
13
Challenge Create a new program that lets the user select which logic gate they want to use by pressing the buttons on the micro:bit: Button A = NOT Button B = AND Buttons A + B = OR Hint: The code below shows you how to check whether a button has been pressed:
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.