42Digital electronics l l l Analogue and digital electronics Logic gates Logic gate control systems l l ●● Analogue and digital electronics There are two main types of electronic circuits, devices or systems – analogue and digital. In analogue circuits, voltages (and currents) can have any value within a certain range over which they can be varied smoothly and continuously, as shown in Figure 42.1a. They include amplifier-type circuits. voltage + 0 time a voltage 0 ‘high’ ‘low’ time – b ●● Logic gates a) NOT gate or inverter This is the simplest gate, with one input and one output. It produces a ‘high’ output if the input is ‘low’, i.e. the output is then NOT high, and vice versa. Whatever the input, the gate inverts it. The symbol and truth table are given in Figure 42.2. ▲ ▲ Figure 42.1 In digital circuits, voltages have only one of two values, either ‘high’ (e.g. 5 V) or ‘low’ (e.g. near 0 V), as shown in Figure 42.1b. They include switching-type circuits such as those we have considered in Chapter 41. A variable resistor is an analogue device which, in a circuit with a lamp, allows the lamp to have a wide range of light levels. A switch is a digital device which allows a lamp to be either ‘on’ or ‘off’. Analogue meters display their readings by the deflection of a pointer over a continuous scale (see Figure 47.4a, p. 220). Digital meters display their readings as digits, i.e. numbers, which change by one digit at a time (see Figure 47.4b, p. 220). Logic gates are switching circuits used in computers and other electronic systems. They ‘open’ and give a ‘high’ output voltage, i.e. a signal (e.g. 5 V), depending on the combination of voltages at their inputs, of which there is usually more than one. There are five basic types, all made from transistors in integrated circuit form. The behaviour of each is described by a truth table showing what the output is for all possible inputs. ‘High’ (e.g. 5 V) and ‘low’ (e.g. near 0 V) outputs and inputs are represented by 1 and 0, respectively, and are referred to as logic levels 1 and 0. – + Problems to solve Electronics and society 193 9781444176421_Section_04.indd 193 20/06/14 7:49 AM 42Digital electronics Input Output 0 1 1 0 NOT gate input output c) Testing logic gates Figure 42.2 NOT gate symbol and truth table b) OR, NOR, AND, NAND gates All these have two or more inputs and one output. The truth tables and symbols for 2-input gates are shown in Figure 42.3. Try to remember the following. OR: output is 1 if input A OR input B OR both are 1 NOR: output is 1 if neither input A NOR input B is 1 AND: output is 1 if input A AND input B are 1 NAND: output is 1 if input A AND input B are NOT both 1 OR gate A B NOR gate F A B B F 0 0 0 0 0 1 0 1 1 0 1 0 1 0 1 1 0 0 1 1 1 1 1 0 B F NAND gate F +5 V +5 V power supply A 0V 0V LED indicator module logic gate module B F IC 0V F A A B The truth tables for the various gates can be conveniently checked by having the logic gate integrated circuit (IC) mounted on a small board with sockets for the power supply, inputs A and B and output F (Figure 42.4). A ‘high’ input (i.e. logic level 1) is obtained by connecting the input socket to the positive of the power supply, e.g. +5 V and a ‘low’ input (i.e. logic level 0) by connecting to 0 V. Figure 42.4 Modules for testing logic gates A AND gate Note from the truth tables that the outputs of the NOR and NAND gates are the inverted outputs of the OR and AND gates, respectively. They have a small circle at the output end of their symbols to show this inversion. A B F The output can be detected using an indicator module containing an LED that lights up for a 1 and stays off for a 0. ●● Logic gate control systems Logic gates can be used as processors in electronic control systems. Many of these can be demonstrated by connecting together commercial modules like those in Figure 42.8b a) Security system A B F A B F 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 1 1 1 0 A simple system that might be used by a jeweller to protect an expensive clock is shown in the block diagram for Figure 42.5. The clock sits on a push switch which sends a 1 to the NOT gate, unless the clock is lifted when a 0 is sent. In that case the output from the NOT gate is a 1 which rings the bell. Figure 42.3 Symbols and truth tables for 2-input gates 194 9781444176421_Section_04.indd 194 20/06/14 7:49 AM Logic gate control systems CLOCK ON = 1 push switch CLOCK OFF = 0 input sensor NOT gate 0 bell 1 0 temperature sensor NOT gate 1 output transducer processor 1 AND gate heater control 1 light sensor Figure 42.5 Simple alarm system b) S afety system for a machine operator 1 AND gate switch B processor Figure 42.7 Heater control system A safety system could prevent a machine (e.g. an electric motor) from being switched on before another switch had been operated, for example, by a protective safety guard being in the correct position. In Figure 42.6, when switches A and B are on, they supply a 1 to each input of the AND gate which can then start the motor. switch A 1 d) Street lights A system is required that allows the street lights either to be turned on manually by a switch at any time, or automatically by a light sensor when it is dark. The arrangement in Figure 42.8a achieves this since the OR gate gives a 1 output when either or both of its inputs are 1. The system can be demonstrated using the module shown in Figure 42.8b. 1 motor 1 or 0 switch OR gate 1 1 street lights Figure 42.6 Safety system for controlling a motor c) Heater control system The heater control has to switch on the heating system when it is light sensor 0 NOT gate 1 Figure 42.8a Control system with manual override (i) cold, i.e. the temperature is below a certain value and the output from the temperature sensor is 0, and (ii) daylight, i.e. the light sensor output is 1. With these outputs from the sensors applied to the processor in Figure 42.7, the AND gate has two 1 inputs. The output from the AND gate is then 1 and will turn on the heater control. Any other combination of sensor outputs produces a 0 output from the AND gate, as you can check. Figure 42.8b Module for demonstrating street lights ▲ ▲ 195 9781444176421_Section_04.indd 195 20/06/14 7:49 AM