## Introduction to Logic Circuits

### Introduction

Logic circuits deal with digital signals or digital inputs and produce digital outputs. They manipulate information that is in a digital format. This is useful because digital signals can be used to represent binary numbers and so logic circuits can manipulate binary mathematics - this makes them very powerful. Many modern devices use digital electronics and logic circuits are fundamental to using digital electronics.

There are two distinct types of digital circuit:

Combinational Logic Circuits are circuits where the output only depends on the inputs. If the inputs change, the output immediately changes too. The combination of the inputs determines what the output(s) will be. Examples of combinational logic circuits include:

• Simple logic gates
• Logic circuits containing multiple logic gates
• Logic circuits with multiple inputs

Synchronous Logic Circuits are circuits where the output depends on the inputs and also what the inputs were previously. When the inputs change the outputs do not necessarily change immediately. The output depends on the state of the inputs and how the inputs have changed some time before. Examples of synchronous logic circuits include:

• Monostable circuits
• Bistable circuits, latches and flip flops
• Astable circuits
• Counters
• Shift registers

### Digital and Analogue

Digital signals have only two possible states - they are either ON or OFF. ON is called Logic 1. OFF is called Logic 0. In electrical circuits these states are represented by voltages. Logic 1 is a high voltage and is usually understood to be +5 V. Logic 0 is a low voltage and is usually understood to be 0 V. However, this is not always the case. If a circuit is power by a 9 V battery then Logic 1 might be anything above 6 V and Logic 0 might be anything below, say, 3 V depending on exactly what components are being used so Logic 1 and Logic 0 are not fixed in stone. The value in the middle - between 3 V and 6 V in this case - is undefined and is neither Logic 1 or Logic 0.

Analogue signals can have any value between two limits. An analogue signal could be between 0 V and 9 V when a circuit is run off a 9 V battery or between −15 V and +15 V in a circuit which is run off a ±15 V power supply. Analogue signals can be both positive and negative and take any value between the maximum and minimum values.

The diagrams illustrate the difference between analogue and digital signals:

### Testing logic circuits

When does logic 0 become logic 1? At exactly what voltage a logic circuit decides that the input is no longer a '0' and is now a '1' depends on the circuit. To be safe we usually try and use a value close to zero volts for logic 0 and some voltage close to the supply voltage for logic 1. For logic gates using a 5 V supply it is usually the case that anything below 2 V is a Logic 0 and anything above 3 V is a Logic 1 but it is always a good idea to check.

The circuit shown can be used to investigate the exact transition point of a logic gate. The potentiometer provides a variable input voltage and voltmeter measures the input voltage. A second voltmeter measures the output voltage.

A graph of Input voltage against Output voltage is called the transfer characteristic of the logic gate - it shows how the input and output voltages are related. The diagram shows a typical transfer characteristic for a Logic NOT gate but it should be noted that all logic gates have their own transfer characteristics and, if the exact values are needed, then the logic gate must be tested.

### Inputs and Outputs

How do we provide an input to our logic circuit? If the input to a logic circuit is derived from another logic circuit then there is no problem as it will always be either fully Logic 0 or fully Logic 1. If we are using switches as our inputs then we must be careful not to leave any wires 'unconnected' (technically such an unconnected input is called 'floating'). An input that is not connected to anything is not at Logic 1 or Logic 0, it is Logic whatever it wants to be ... and this will cause all sorts of problems and erratic behaviour. Therefore, the rule is inputs should always be connected to something. Pull-up or pull-down resistors are used to ensure that the input to the logic circuit is always connected to something.

Pull-up and pull-down resistors are nominally 10 kΩ but can be any high value between 1 kΩ and 100 kΩ.

When the push button is not pressed, the logic circuit is connected to 0 V through the resistor. The input to the logic circuit is Logic 0.

When the push button is pressed, the logic circuit is connected directly to the positive power supply. The input to the logic circuit is Logic 1.

The resistor is necessary so that, when the button is pressed, the positive power supply is not simply connected to 0 V resulting in a short circuit.

The circuit is effectively a potential divider circuit where R1 is either 0 Ω or virtually infinite resistance.

When the push button is not pressed, the logic circuit is connected to positive through the resistor. The input to the logic circuit is Logic 1.

When the push button is pressed, the logic circuit is connected directly to 0 V. The input to the logic circuit is Logic 0.

Again, the resistor is necessary so that, when the button is pressed, the positive power supply is not simply connected to 0 V resulting in a short circuit.

The circuit is effectively a potential divider circuit where R2 is either 0 Ω or virtually infinite resistance.