**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 a 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
- Logic operators such as Full Adders, Half Adders and Multiplexers

**Synchronous** Logic Circuits are circuits where the output depends on the inputs and also what the inputs were in the past. 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 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 +5V. Logic 0 is a low voltage and is usually understood to be 0V. However, this is not always the case - if a circuit is power by a 9V battery then Logic 1 might be anything above 6V and Logic 0 might be anything below, say, 3V depending on exactly what components are being used so Logic 1 and Logic 0 are not fixed in stone. The bit in the middle - between 3V and 6V 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 0V and 9V when a circuit is run off a 9V battery or between -15V and +15V in a circuit which is run off a ± 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:

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 zero volts and some voltage close to the supply voltage. For logic gates using a 5V supply it usually the case that anything below 2V is a Logic 0 and anything above 3V 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.

How do we provide an input to our logic circuit? If the input to a logic circuit is derived from another logic circuit then no problem - it will always be either fully Logic 0 or fully Logic 1 - but if we are using switches as our inputs then we must be careful not to leave any stray wires 'unconnected' (technically such an input is called 'floating'). An input that is not connected 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. This is shown below. Pull up and pull down resistors are nominally 10kΩ but can be any high value between 1kΩ and 100kΩ.

When the push button is not pressed, the logic circuit is connected to 0V 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 0V resulting in a short circuit.

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 0V - 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 0V resulting in a short circuit.

© Paul Nicholls

April 2016

Electronics Resources by Paul Nicholls is licensed under a Creative Commons Attribution 4.0 International License.