Learnearn.uk » A Level Computer Science Home » Logic Gates

# Logic Gates

## Introduction

### Truth Tables

When we are working out what possibilities exist for a particular Boolean logic structure, we can use a truth table to represent that data.

Using the previous example we can produce a simple truth table for the results.

 Input Output 1 1 0 0

## AND

AND Gates

A Boolean AND gate works by the following rules:

1. If both inputs are true, then the output will be True.
2. Otherwise the output will be false

Scratch Example

Challenge 1 – AND Gate truth table

Can you fill out the truth table for an AND gate?

## OR

OR Gates

A Boolean OR gate works by the following logic:

1. If either input is True, the output is True.
2. If both inputs are True, the output is True.
3. Otherwise the output is false.

Scratch Example

Challenge 2 – Can you work out the truth table for a Boolean OR gate?

## NOT

### NOT Gate

A Boolean NOT gate simply reverses whatever input is given.

1. If the input is True, the output is False
2. If the input is False, the output is True

Scratch Not gate Example

Challenge 3 – Can you write a truth table for a NOT gate?

## Activity 1

Have a go at connecting up multiple logic gates to see what happens, using the simulator below. Can you work out the inputs and outputs for the following examples.

Example 1

Example 2

Example 3

Example 4

## Activity 2

Activity 2 – Applying Logic Gates

Using the link below, see if you can make the following systems:

Logic Gates Application Simulator

System 1 – Fan cooling system.

If the main system switch is turned on, then the fan will operate when:

• Every 5 seconds
• When The manual override button is pressed.

System 2 – Basic Alarm System

Make a system where if any of the 3 sensors (use 3 switches to represent sensors) are triggered, the alarm light will flash RED.

System 3 – Advanced Alarm System