Combinational logic systems

Similar documents
Chapter 1: Logic systems

Digital electronic systems are designed to process voltage signals which change quickly between two levels. Low time.

(d) describe the action of a 555 monostable timer and then use the equation T = 1.1 RC, where T is the pulse duration

Lecture 6: Time-Dependent Behaviour of Digital Circuits

New Students Day Activity

Overview. Multiplexor. cs281: Introduction to Computer Systems Lab02 Basic Combinational Circuits: The Mux and the Adder

1 Boolean Algebra Simplification

Experiment 7: Magnitude comparators

1.10 (a) Function of AND, OR, NOT, NAND & NOR Logic gates and their input/output.

University of Toronto Faculty of Applied Science and Engineering Department of Electrical and Computer Engineering Midterm Examination

EGC221: Digital Logic Lab

11.1 As mentioned in Experiment 10, sequential logic circuits are a type of logic circuit where the output of

Latches. October 13, 2003 Latches 1

CARLETON UNIVERSITY. Deparment of Electronics ELEC 2607 Switching Circuits January 19, Overview;

Binary addition (1-bit) P Q Y = P + Q Comments Carry = Carry = Carry = Carry = 1 P Q

Boolean algebra. Examples of these individual laws of Boolean, rules and theorems for Boolean algebra are given in the following table.

Digital Logic Design ABC. Representing Logic Operations. Dr. Kenneth Wong. Determining output level from a diagram. Laws of Boolean Algebra

Simplifying Logic Circuits with Karnaugh Maps

Learning Objectives:

Designing Information Devices and Systems I Fall 2018 Lecture Notes Note Introduction: Op-amps in Negative Feedback

Contents. Chapter 3 Combinational Circuits Page 1 of 36

of Digital Electronics

CARLETON UNIVERSITY. X = Y 0 0 X > Y 1 0 X < Y 0 1 never 1 1 happens. Examples

Digital electronics form a class of circuitry where the ability of the electronics to process data is the primary focus.

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Digital Logic

Lab 4. Current, Voltage, and the Circuit Construction Kit

School of Computer Science and Electrical Engineering 28/05/01. Digital Circuits. Lecture 14. ENG1030 Electrical Physics and Electronics

Boolean Algebra and Digital Logic 2009, University of Colombo School of Computing

6 Simplification of. Boolean Functions

Boolean Algebra and Digital Logic

Semi-Conductors insulators semi-conductors N-type Semi-Conductors P-type Semi-Conductors

Sample Test Paper - I

T02 Tutorial Slides for Week 6

Boolean Algebra. The Building Blocks of Digital Logic Design. Section. Section Overview. Binary Operations and Their Representation.

Experiment 9 Sequential Circuits

RC Circuits. 1. Designing a time delay circuit. Introduction. In this lab you will explore RC circuits. Introduction

Computer Organization: Boolean Logic

ENGG 1203 Tutorial_9 - Review. Boolean Algebra. Simplifying Logic Circuits. Combinational Logic. 1. Combinational & Sequential Logic

CHAPTER 12 Boolean Algebra

Laboratory 1. Introduction - Resistor Codes, Breadboard, and Basic Measurements. Learn how to construct basic electrical circuits using a breadboard.

CHAPTER1: Digital Logic Circuits Combination Circuits

Boolean Algebra. Boolean Variables, Functions. NOT operation. AND operation. AND operation (cont). OR operation

MM74C00 MM74C02 MM74C04 Quad 2-Input NAND Gate Quad 2-Input NOR Gate Hex Inverter

Mealy & Moore Machines

Digital Circuits. 1. Inputs & Outputs are quantized at two levels. 2. Binary arithmetic, only digits are 0 & 1. Position indicates power of 2.

Signals and Systems Digital Logic System

UC Berkeley College of Engineering, EECS Department CS61C: Representations of Combinational Logic Circuits

EE40 Lec 15. Logic Synthesis and Sequential Logic Circuits

control in out in out Figure 1. Binary switch: (a) opened or off; (b) closed or on.

Every time has a value associated with it, not just some times. A variable can take on any value within a range

nmos IC Design Report Module: EEE 112

Boole Algebra and Logic Series

National Quali cations SPECIMEN ONLY. Date of birth Scottish candidate number

Week-I. Combinational Logic & Circuits

Digital Logic (2) Boolean Algebra

Electric Field Mapping

Electrical Circuits. Winchester College Physics. makptb. c D. Common Time man. 3rd year Revision Test

Name Date Time to Complete

MM74C00 MM74C02 MM74C04 Quad 2-Input NAND Gate Quad 2-Input NOR Gate Hex Inverter

THE HALL EFFECT. Theory

Written reexam with solutions for IE1204/5 Digital Design Monday 14/

ECE 220 Laboratory 4 Volt Meter, Comparators, and Timer

Boolean Algebra & Logic Gates. By : Ali Mustafa

Combinational Digital Design. Laboratory Manual. Experiment #6. Simplification using Karnaugh Map

Digital logic signals

Digital logic signals

CSC258: Computer Organization. Digital Logic: Transistors and Gates

CSC9R6 Computer Design. Practical Digital Logic

Functions. Computers take inputs and produce outputs, just like functions in math! Mathematical functions can be expressed in two ways:

Building a Computer Adder

Digital Electronics Final Examination. Part A

Computer Organization I. Lecture 13: Design of Combinational Logic Circuits

EE371 - Advanced VLSI Circuit Design

MM74C85 4-Bit Magnitude Comparator

Introduction to Karnaugh Maps

Digital Electronics I

Laboratory II. Exploring Digital Logic

II. COMBINATIONAL LOGIC DESIGN. - algebra defined on a set of 2 elements, {0, 1}, with binary operators multiply (AND), add (OR), and invert (NOT):

Chapter 3 Combinational Logic Design

Slide Set 3. for ENEL 353 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary

Section 2.7 Solving Linear Inequalities

Lecture 22 Chapters 3 Logic Circuits Part 1

ECE/CS 250: Computer Architecture. Basics of Logic Design: Boolean Algebra, Logic Gates. Benjamin Lee

4 Switching Algebra 4.1 Axioms; Signals and Switching Algebra

(Refer Slide Time: 1:49)

The process of analysing a circuit using the Laplace technique can be broken down into a series of straightforward steps:

ENG2410 Digital Design Combinational Logic Circuits

Logic Gate Level. Part 2

Advanced Structural Analysis Prof. Devdas Menon Department of Civil Engineering Indian Institute of Technology, Madras

Electric Field Mapping

Boolean Logic Prof. James L. Frankel Harvard University. Version of 3:20 PM 29-Aug-2017 Copyright 2017, 2016 James L. Frankel. All rights reserved.

NTE4501 Integrated Circuit CMOS, Dual 4 Input NAND Gate, 2 Input NOR/OR Gate, 8 Input AND/NAND Gate

BOOLEAN ALGEBRA THEOREMS

What happens when things change. Transient current and voltage relationships in a simple resistive circuit.

Logic Gates and Boolean Algebra

Number System conversions

Combinational Logic Trainer Lab Manual

Vidyalankar S.E. Sem. III [CMPN] Digital Logic Design and Analysis Prelim Question Paper Solution

Intro To Digital Logic

WEEK 2.1 BOOLEAN ALGEBRA

Transcription:

Combinational logic systems Learners should be able to: (a) recognise 1/0 as two-state logic levels (b) identify and use NOT gates and 2-input AND, OR, NAND and NOR gates, singly and in combination (c) produce a suitable truth table from a given system specification and for a given logic circuit (d) use truth tables to analyse a system of gates (e) use Boolean algebra to represent the output of truth tables or logic gates and use the basic Boolean identities A.B = A+B and A+B = A.B (f) design processing systems consisting of logic gates to solve problems (g) simplify logic circuits using NAND gate redundancy (h) analyse and design systems from a given truth table to solve a given problem (i) (j) use data sheets to select a logic IC for given applications and to identify pin connections design and use switches and pull-up or pull-down resistors to provide correct logic level/edge-triggered signals for logic gates and timing circuits 180

Introduction In this chapter we will be concentrating on the basics of digital logic circuits which will then be extended in Component 2. We should start by ensuring that you understand the difference between a digital signal and an analogue signal. Voltage (V) An analogue signal Max This is a signal that can have any value between the zero and maximum of the power supply. Changes between values can occur slowly or rapidly depending on the system involved. A digital signal This is a signal that can only have two finite values, usually at zero and maximum of the power supply. Changes between these two values occur instantaneously. Min 0 V Voltage (V) Max time (s) Min 0 V For this part of the course we will concentrate on digital systems. time (s) Recap of work covered in Chapter 1 When an input or output signal is at the minimum power supply voltage (usually 0 V) this is referred to as a LOW signal or LOGIC 0 signal. When an input or output signal is at the maximum power supply voltage this is referred to as a HIGH signal or LOGIC 1 signal. Remember then that a digital signal is a two-state system with input and output signals being either referred to as high/low, 0/1, on/off depending on the application. The behaviour of a logic gate is summarised in a table, called a truth table We will now look at the basic building blocks of all digital systems, logic gates and their associated truth tables. 181

Truth Tables The behaviour of a logic gate is summarised in a table, called a truth table. In this course we will only consider the truth tables for logic gates with up to two inputs. Here is a summary of the three logic gates you have already studied: GATE SYMBOL TRUTH TABLE FUNCTION NOT (INVERTER) Input Output A Q 0 1 1 0 Signal out of gate is the opposite of the signal in, i.e. it inverts the input signal AND Inputs Output B A Q 0 0 0 0 1 0 1 0 0 1 1 1 The output Q is only at a logic 1 when input A AND input B are at a logic 1 OR Inputs Output B A Q 0 0 0 0 1 1 1 0 1 1 1 1 The output Q is at a logic 1 when input A OR input B OR both are at a logic 1 182

We will now look at two additional logic gates: The NAND gate The symbol for a 2-input NAND gate is: The truth table for the 2-input NAND gate is shown below. If you compare this truth table with that for the AND gate, you will find that the output Q is the exact opposite of the AND gate output. The NOR gate The symbol for a 2-input NOR gate is: Inputs Output B A Q 0 0 1 0 1 1 1 0 1 1 1 0 The truth table for the 2-input NOR gate is shown below. Inputs Output B A Q 0 0 1 0 1 0 1 0 0 1 1 0 If you compare this truth table with that for the OR gate, you will find that the output Q is the exact opposite of the OR gate output. 183

Practical Logic Gates Logic gates are available within an integrated circuit (IC) a set of electronic circuits built on the same wafer of semiconductor material. These logic ICs are usually supplied in plastic DIL (dual in line) packages containing several logic gates of the same type. The diagram shows one of these logic IC packages. Pin 1 identification There are two common types of package available, known as TTL or 7400 series and CMOS or 4000 series. Examination questions will only test CMOS devices. However, you may choose to use TTL devices for your project work. The data sheet for a logic gate package includes the pinout diagram showing how the pins connect to the logic gates inside it. The pinout diagrams below relate to ICs known as quad 2-input AND gates. The TTL AND gate is referred to as a 7408 whilst the CMOS version is referred to as a 4081B. TTL AND gate CMOS AND gate Using the right pinout is important, as incorrect connections can damage the whole package. We will look at some more pinout diagrams later on. 184

Analysis of Simple Logic Circuits You will need to recognise truth tables for the five basic gates individually and in simple combinations. You will also need to be able to complete a truth table for a larger system. We will now consider a couple of examples of these systems. Example 1: Study the following logic system carefully and then complete the truth table that follows: Inputs Outputs B A C Q 0 0 0 1 1 0 1 1 In this problem, the output of the NOT gate has been labelled C. The first stage is to complete the output column for C which is the NOT of A as shown below. Inputs Outputs B A C Q 0 0 1 0 1 0 1 0 1 1 1 0 Now we need to complete the final column Q which is the output of the AND gate with B and C as the inputs. Inputs Outputs B A C Q 0 0 1 0 0 1 0 0 1 0 1 1 1 1 0 0 Do not fall into the trap of writing the answer to the Q column in the order you would normally do for the truth table for an AND gate. Because in this case the inputs to the AND gate are not in the same order as that given in the standard AND gate truth table provided earlier. 185

Example 2: Study the following logic system carefully and then complete the truth table that follows: Inputs Outputs C B A F G Q 0 0 0 1 0 1 0 0 1 1 0 0 0 1 0 0 0 1 0 1 1 0 0 0 1 0 0 1 1 0 1 0 1 1 1 0 1 1 0 0 0 1 1 1 1 0 0 0 You can see that the truth table for a 3-input logic system contains eight possible input combinations. Notice the way the logic state of each input changes as you move down the table. First check the output column for the NOT gate (Column F) {The input is B.} Then check the output column for the AND gate (Column G) {The inputs are F and C.} Finally check the final output from the NOR gate (Column Q) {The inputs are A and G.} 186

Investigation 6.1 You will need to use a simulation program such as Circuit Wizard or Yenka Technology to complete this investigation. Note: You can use the built-in inputs and outputs that are available in these simulation programs. The input switches and logic indicator turn red to indicate logic 1.The circuit being tested would look something like this diagram: Set up each of the logic systems using your simulation program and use the program to complete the truth table for each system: 1. 2. Inputs Output B A Q 0 0 0 1 1 0 1 1 Inputs Output C B A Q 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 187

Exercise 6.1 1. Look at the following logic symbols labelled A E. A B C D E a) Which is the correct symbol for an AND gate. b) Which is the correct symbol for a NOT gate. c) Which is the correct symbol for a NOR gate. d) Which is the correct symbol for a NAND gate. e) Which is the correct symbol for an OR gate. 2. Complete the following truth tables. a) AND gate. b) NOR gate. Inputs Output B A Q 0 0 0 1 1 0 1 1 Inputs Output B A Q 0 0 0 1 1 0 1 1 c) NAND gate. d) OR gate Inputs Output B A Q 0 0 0 1 1 0 1 1 Inputs Output B A Q 0 0 0 1 1 0 1 1 188

3. Study the following logic system carefully and then complete the truth table that follows: Inputs Outputs B A K Q 0 0 0 1 1 0 1 1 4. Study the following logic system carefully and then complete the truth table that follows: Inputs Outputs C B A F G Q 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 189

5. Study the following logic system carefully and then complete the truth table that follows: Inputs Outputs C B A D E F G Q 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 190

Pull-Up / Pull-Down Resistors Up until now we have shown the input connections to a logic gate either with: labelled input terminals or connected to a logic input These diagrams are called schematic circuit diagrams and help us to concentrate on what is happening to the logic signals within the logic circuit without worrying too much how the inputs are wired up. If we want to build a logic circuit we have to provide the logic gate with a suitable input sub-system to provide the correct logic levels. The input to a logic gate can come from a number of different sources, but for the purposes of this unit we are going to concentrate on mechanical switches. Whichever type of switch we use, they have to be used along with a series resistor as part of a voltage divider circuit. We have to be careful which way around the resistor and switch are connected in the voltage divider circuit to produce either a logic 0 signal or a logic 1 signal when the switch is pressed. Two input sub-system circuits using a push-to-make switch are shown below. Signal at point X is at logic 0 when switch is pressed Signal at point Y is at logic 1 when switch is pressed The resistor used in Circuit A is called a pull-up resistor and the resistor used in Circuit B is called a pull-down resistor. This is because of their behavior in the circuit, either pulling up the voltage at the input to logic 1 or pulling down the voltage to logic 0 when the switch is not pressed. 191

In Circuit A, before the switch is pressed, there is no connection to the 0 V line, and the input to the logic gate is pulled up to 5 V, giving a logic 1 input to the logic system. When the switch is operated, the input to the logic system is connected to the 0 V line through the switch and the logic level falls to logic 0. In Circuit B, before the switch is pressed, there is no connection to the 5 V line, and the input to the logic gate is pulled down to 0 V, giving logic 0 input to the logic system. When the switch is operated, the input to the logic system is connected to the 5 V line through the switch, changing the logic level to logic 1. In summary: Circuit A outputs a logic 0 signal until the switch is pressed. It then outputs logic 1. Circuit B outputs a logic 1 signal until the switch is pressed. It then outputs logic 0. Use of data sheets The data sheet for a particular logic gate package shows how the pins are connected to the logic gates inside it. When doing practical work you will need to use data sheets to examine the pinout diagrams for different logic gates. You could also be asked to identify certain pins on a pinout diagram. Logic gates are available with up to eight inputs per gate, and the following diagrams show the pinouts for a selection of CMOS 4000 series ICs: 192

Here are some of the more common pinout diagrams for 7400 Series TTL logic gates. Although you will not consider them in this course you might use TTL logic gates in your project. 193

Investigation 6.2 You can set up the circuits in this investigation either on a simulation program or breadboard. 1. Set up the following circuits and use a logic probe to complete the tables below by inserting high or low for each state of the switches. Switch SW1 Output A Switch SW1 Output A Open Open Closed Closed 2. Set up this circuit and press switches A and B in the order shown in the truth table. Record the results and complete the truth table. If the LED is on, the output is high. If the LED is off, the output is low. Note: If you are setting this circuit up on Circuit Wizard ensure the voltage setting for the logic gates is set to the same voltage as the power supply. Go to Project Simulation Power supply and check the voltage setting. Inputs Output B A Q 0 0 0 1 1 0 1 1 194

Exercise 6.2 1. The pinout diagram for a logic IC is shown below. G a) How many logic gates are contained in this IC? b) How many inputs does each gate have? c) Give the number of the pin connected to the output of gate G? d) Which two pins should be connected to the power supply? e) What is the name given to the type of logic gate contained in this IC? Choose from the following list: AND OR NOT NAND NOR Answer: 2. Study the circuits below and complete the statements that follow: a) In circuit C with the switch open, the input to the logic system is at logic b) In circuit C with the switch closed, the input to the logic system is at logic c) In circuit D with the switch open, the input to the logic system is at logic d) In circuit D with the switch closed, the input to the logic system is at logic 195

3. These questions require the CMOS data sheets provided earlier. a) What type of logic gate is contained in the 4011 package? b) How many inputs do the logic gates in the 4072 package have? c) How many logic gates are there in the 4002 package? d) Which 2 packages have some pins that are not connected to anything? e) What pin number is the positive supply for a 4081 package? f) What pin number(s) are the inputs of the logic gate, whose output is connected to pin 13 of the 4072 package? 4. Study the circuit below and complete the statements that follow: a) Resistor R1 is a pull resistor and R2 is a pull resistor. b) When switch SW2 is pressed input B is at logic c) When both switches are pressed output Q is at logic 196

Converting a Truth Table into a Logic Diagram In the previous section we looked at how a system of logic gates could be used to complete a truth table to illustrate the conditions needed for the output to produce a logic 1. We will now consider how we can reverse this process and construct a logic circuit diagram from a truth table. This is best done by looking at a couple of examples. Note: In the following examples the outputs have been chosen so that they are not the standard outputs of one of the five logic gates considered previously. Example 1: The truth table for a logic system is: Inputs Output B A Q 0 0 0 0 1 1 1 0 0 1 1 0 We first have to identify all the combinations of the inputs that produce a logic1 at the output. In this case it only occurs once, when input A is on and input B is not on. The description of what is required to cause the output to operate gives a very good clue as to the logic gates required in this example. In this case two logic gates are required, a NOT gate and an AND gate. The NOT gate is used to invert the B input, as shown below. The output of this NOT gate is then connected to the AND gate with input A to provide the full solution, as follows: Quick rule In any 2-input logic system, for every row of the truth table for which the output is logic 1, this output can be written in terms of the following input conditions: A, NOT A, B, NOT B depending whether there is a 0 or a 1 in that input cell. The two inputs are linked with an AND. 197

Going back to our example we identify the output row where Q is a logic 1 and note that A = 1 and B = 0. Because B is 0 we write it down as NOT B as shown: Inputs Output B A Q 0 0 0 0 1 1 Output Q = A AND NOT B 1 0 0 1 1 0 This gives the same answer as the longer method. Example 2: The following truth table represents a particular logic function. Use the information in the table to draw a corresponding logic gate system that will produce this function. Inputs Output B A Q 0 0 1 0 1 0 1 0 0 1 1 1 We first have to identify all the combinations of the inputs that cause the output to be logic 1. In this case it occurs in two rows of the truth table. We then label these outputs as explained above in the Quick Rule. Inputs Output B A Q 0 0 1 Output = NOT A AND NOT B 0 1 0 1 0 0 1 1 1 Output = A AND B The output required for the first line of the truth table is: and the output required for the last line of the truth table is: 198

There are two separate parts to the logic system providing the output Q. We need to link the two parts together so that either one part OR the other part produce the output Q. This is done by connecting the output of each part to an OR gate input as shown below: We have some duplicated input terminals, so the circuit diagram can be simplified by linking these together as shown below. Or in words, Q = [NOT A AND NOT B] OR [A AND B] Converting a truth table with three inputs The method shown above can be extended to cover 3-input truth tables as shown below: Inputs Output C B A Q 0 0 0 0 0 0 1 1 Output = A AND NOT B AND NOT C 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 1 Output = A AND NOT B AND C 1 1 0 0 1 1 1 0 Combining these two outputs gives: Q = (A AND NOT B AND NOT C) OR (A AND NOT B AND C) The logic diagram for this system would require 3-input AND gates which are not covered in this course. 199

Truth tables with multiple outputs Quite often a logic system will have more than one output. For example a set of traffic lights might have three outputs. For this type of system we can follow a simple set of rules. For each output column of the truth table ask yourself the following questions in the order listed below 1. Is the output column pattern the same as one of the input column patterns? If the answer is yes, then Q = The Input (e.g. Q = B) 2. Is the output column pattern the inverse of the input column pattern? If the answer is yes, then Q = NOT The Input (e.g. Q = NOT C) 3. Is the output column pattern the same as a logic gate output? If the answer is yes, then Q = logic gate expression (e.g. Q = A OR B) 4. Is the output column pattern the inverse of one of the other output patterns already identified? If the answer is yes, then Q = NOT Other Output (e.g. Q3 = NOT Q1) 5. If the answer is no, all four questions then use the Quick rule by labelling rows of the outputs which are logic 1 and link with an OR gate. e.g. Q = [NOT A AND NOT B] OR [A AND B] 200

Example: The following truth table shows the outputs required for three LEDs used to represent the operation of a set of traffic lights. Determine the combination of logic gates required to produce the output pattern shown. Inputs Outputs B A Red Yellow Green 0 0 1 0 0 0 1 1 1 0 1 0 0 0 1 1 1 0 1 0 Here we have three separate outputs to be produced by just two inputs. To solve this we just treat each individual output as a separate problem. If you examine the input B column and Red output column carefully what do you notice? They are reproduced below with these columns highlighted. Inputs Outputs B A Red Yellow Green 0 0 1 0 0 0 1 1 1 0 1 0 0 0 1 1 1 0 1 0 Comparing the two highlighted columns we can see that the Red output is the exact opposite of the B input column. This means that if we simply invert the input B signal, this will produce the Red output. i.e. Red = NOT B Now for the Yellow output. Once again check the truth table carefully. The solution is that the Yellow output follows the A input exactly, and therefore to produce the Yellow output no logic gates are required. It is simply a case of connecting the Yellow output to the A input. i.e. Yellow = A Here is the solution for the Yellow output: 201

Finally we have to consider the Green output. A check of the truth table shows there is no simple relationship to the inputs as was the case with the Red and Yellow outputs. Neither does the output correspond to the output of a logic gate. We have no choice therefore other than to use the Quick rule to solve this part of the problem. You should be able to produce the system as shown below. Inputs Outputs B A Red Yellow Green 0 0 1 0 0 0 1 1 1 0 1 0 0 0 1 Green = NOT A AND B 1 1 0 1 0 This gives; If we connect all three sections together the final system design will look like this: Note: If we were very observant we could have noticed that the Green output can be obtained from a NOR gate connected to the Red and Yellow outputs. Inputs Outputs B A Red Yellow Green 0 0 1 0 0 0 1 1 1 0 1 0 0 0 1 1 1 0 1 0 i.e. Green = Red NOR Yellow 202

The final system would then become: Both of these solutions are equally valid. In the next investigation you will be asked to confirm that both solutions produce the correct output pattern. 203

Investigation 6.3 1. Set up the following traffic light system using your simulation program. Inputs Outputs B A Red Yellow Green 0 0 0 1 1 0 1 1 Complete the truth table for the traffic light sequence and compare you results with the truth table given in the previous example Is the: Red sequence correct. Yellow sequence correct. Green sequence correct. 2. Repeat the investigation for the alternative solution provided in the example. Pull-down resistors and LED indicators have been included so the circuit can be built on breadboard. Inputs Outputs B A Red Yellow Green 0 0 0 1 1 0 1 1 Is the: red sequence correct?. yellow sequence correct?. green sequence correct?. 204

Exercise 6.3 1. The following truth table represents a particular logic function. Use the information in the table to draw a corresponding logic gate system that will produce this function. Inputs Output B A Q 0 0 0 0 1 1 1 0 0 1 1 0 2. The following truth table represents a particular logic function. Use the information in the table to draw a corresponding logic gate system that will produce this function. Inputs Output B A Q 0 0 0 0 1 1 1 0 1 1 1 0 205

3. An electronic system has two input sensors A and B, and three outputs P, Q and R. The truth table showing how the input sensors control the outputs is shown below. Inputs Outputs B A P Q R 0 0 1 0 1 0 1 0 0 0 1 0 1 0 0 1 1 0 1 0 a) Study the P output. It is the inverse of one of the inputs. Write down an expression to describe this output. P =... b) Study the Q output. There is one type of logic gate that will provide this. What is the name of this gate?... c) Study the R output. There is one type of logic gate that will provide this. What is the name of this gate?... d) You have a selection of AND, OR, NOT, NAND and NOR gates available. Draw a labelled diagram to show how the logic system can be made. 206

4. The following truth table shows the outputs required for three LEDs used to represent the operation of a set of traffic lights. Determine the combination of logic gates required to produce the outputs required. Draw a labelled diagram to show how the logic system can be made. Inputs Outputs B A Red Yellow Green 0 0 0 1 0 0 1 0 0 1 1 0 1 1 0 1 1 1 0 0 207

Boolean Notation There is a shorthand way of writing down the function of logic gates, using a special type of algebra called Boolean algebra. This is used extensively for advanced work in digital electronics. We shall briefly consider how to express the output of a truth table and logic gates in Boolean notation. We will start by looking at the five basic gates introduced previously. There are three basic things to remember: 1. A dot. between two input labels is read as AND. 2. A plus + between two input labels is read as OR. 3. A bar over the top of an input label is read as NOT. Gate Symbol Boolean Notation NOT Q = A read as Q = NOT A AND Q = A.B read as Q = A AND B OR Q = A + B read as Q = A OR B NAND Q = A.B read as Q = A NAND B NOR Q = A + B read as Q = A NOR B In addition to the five Boolean notations shown above, each line of a truth table for which the output is a 1 can also be written in Boolean notation 208

Consider the solution to Example 2 on page 198: Inputs Output B A Q 0 0 1 0 1 0 1 0 0 1 1 1 Output = NOT A AND NOT B Output = A AND B Using Boolean notation the outputs can be labelled as follows: Inputs Output B A Q 0 0 1 0 1 0 1 0 0 1 1 1 Output = A AND B Output = A AND B Remember that these expressions need to be linked together with an OR to produce the output Q, so the full Boolean expression for Q can be written as: Q = (A AND B) OR (A AND B) Q = (A.B) + (A.B) We can extend this idea to larger systems with more inputs; the process is the same: Identify each line in the table that has logic 1 output. Write down the combination of inputs that produce this output in Boolean notation. Link together with an OR to produce the output Q. 209

For example, in this table there are four combinations of inputs that will produce an output at Q. In order to write down the Boolean equation for the whole system, we first have to write down the Boolean equation for each line in the truth table where the output is a 1. All input variables (three in this case) must be included in each Boolean equation on each of these lines, as shown below: C B A Q Boolean Equation 0 0 0 0 0 0 1 1 A.B. C 0 1 0 0 0 1 1 1 A.B. C 1 0 0 1 A.B. C 1 0 1 1 A.B. C 1 1 0 0 1 1 1 0 To obtain the Boolean equation for the whole system we simply take each of these terms and OR them together: Q = A.B.C + A.B.C + A.B.C + A.B.C The logic diagram for this system would require 3-input AND gates and OR gates. These are not covered in this course, but you are required to be able to produce the Boolean equation for 2-, 3- and 4-input truth tables. 210

Two special identities 1. The Boolean expression A.B is the same as A + B. We can check this by looking at the truth table below B A B A A. B A + B 0 0 1 1 1 1 0 1 1 0 1 1 1 0 0 1 1 1 1 1 0 0 0 0 This shows that the two logic expressions are the same. 2. The Boolean expression A + B, is the same as A.B. We can check this by looking at the truth table below. B A B A A + B A. B 0 0 1 1 1 1 0 1 1 0 0 0 1 0 0 1 0 0 1 1 0 0 0 0 This shows that the two logic expressions are the same. 211

Exercise 6.4 1. The Boolean equations labelled A G, below are to be used to answer the following questions. A) Q = A.B B) Q = A+B C) Q = A + B D) Q = A E) Q = A.B F) Q = A.B G) Q = A + B i. Which equation is correct for an AND gate? ii. Which equation is correct for a NOT gate? iii. Which equation is correct for a NOR gate? iv. Which equation is correct for a NAND gate? v. Which equation is correct for an OR gate? vi. Which equation produces the same logic output as G? vii. Which equation produces the same logic output as B? 2. Write down the Boolean equations for outputs X, Y and Z: B A X Y Z 0 0 1 0 0 0 1 1 0 0 1 0 0 0 1 X = Y = Z = 1 1 0 1 0 212

3. Complete the table with the Boolean equations when the output Q is at logic 1. C B A Q Boolean Equation 0 0 0 1 0 0 1 0 0 1 0 0 0 1 1 1 1 0 0 0 1 0 1 0 1 1 0 1 1 1 1 0 Hence write down the full Boolean equation for the system: 4. Complete the table with the Boolean equations when the output Q is at logic 1. C B A Q Boolean Equation 0 0 0 0 0 0 1 0 0 1 0 1 0 1 1 0 1 0 0 0 1 0 1 1 1 1 0 0 1 1 1 1 Hence write down the full Boolean Equation for the system: 213

Logic System Design In the previous two sections we have considered the logic gates available for us to use in electronic system design. We have derived truth tables from logic circuits, and have constructed logic circuits from truth tables. In this section we will be completing the design process by converting a design brief of a problem into a truth table. Design problems Example 1: A logic system has two input sensors A and B and two outputs. Output 1 is high when sensor A is high and sensor B is high. Output 2 is high either when sensor A is low and sensor B is high, or when sensor A is high and sensor B is high. a) Complete the truth table to satisfy these conditions. b) Draw the circuit diagram for the logic system. Solution a) Output 1 is high only when A = 1 and B = 1. Identify this cell in the output 1 column of the truth table and place a 1 in it. Place zeros in the three other cells in the output 1 column. Output 2 is high when A = 0 and B = 1, or when A = 1 and B = 1. Identify these two cells in the output 2 column of the truth table. Place a 1 in these two cells and zeros in the other two. Inputs Outputs B A Output 1 Output 2 0 0 0 1 1 0 1 1 214

b) You should have obtained the following truth table. Inputs Outputs B A Output 1 Output 2 0 0 0 0 0 1 0 0 1 0 0 1 1 1 1 1 Examine the output 1 pattern. You should realise that it is the same pattern as for an AND gate. Examine the output 2 pattern. You should realise that it is the same as input B. The circuit diagram can then be drawn. Example 2: A system is required to monitor a car s cooling system. When the water level in the radiator is below a certain level a LED will light up. When the engine temperature is above a predetermined value and the water level is too low a buzzer should sound in addition to the LED lighting up. The positioning and signals out of the sensors used are shown below. Radiator A B Moisture Sensor Temperature Sensor Sensor A (moisture) state logic level Wet 0 Dry 1 Sensor B (temperature) state logic level Cool 0 Hot 1 215

a) First we complete the truth table for the system. From the specification, the LED must light every time the radiator water level falls below the minimum this is when sensor A outputs a logic 1. Inputs Outputs B A LED Buzzer 0 0 0 0 1 1 1 0 0 1 1 1 From the specification, the buzzer must sound when the temperature goes above a certain temperature this is when sensor B outputs a logic 1 AND when the radiator water level falls below the minimum this is when sensor A outputs a logic 1. Inputs Outputs B A LED Buzzer 0 0 0 0 0 1 1 0 1 0 0 0 1 1 1 1 b) Determine the logic required to produce each output. For the LED output, the pattern is the same as input A, so no logic gate is required. For the buzzer output, there is one type of gate that will provide this output pattern an AND gate c) Complete the system diagram showing how the system can be made up. 216

Example 3: Before take-off, the pilot and co-pilot of an aircraft carry out preflight safety checks. When all checks have been completed they each move a switch from the up to the down position. When both switches are up, a red indicator on the instrument panel is on. This changes to yellow when at least one of them operates their switch. When both have operated their switches, a green indicator comes on. The engines can only be started when the green indicator is on. Assume that the switches provide logic level 0 in the up position and logic level 1 in their down position. The LED indicators operate on logic level 1. a) Check the completed truth table for the system. Inputs Outputs B A R Y G 0 0 1 0 0 0 1 0 1 0 1 0 0 1 0 1 1 0 1 1 b) Now we need the logic system that can produce these outputs. Take each one in turn. For the RED output there is a standard gate that can produce this output a NOR gate. For the YELLOW output there are actually two ways of generating the YELLOW output. First is a standard gate that can produce the output an OR gate using inputs A and B. Alternatively the output Y is the opposite of the RED output. So we could achieve the same by just inverting the RED output 217

For GREEN output again a standard gate can produce this output an AND gate. The complete system therefore is: 218

Investigation 6.4 Set up the logic system shown below using your simulation program. a) Press switches A and B in the order shown in the truth table and record the results Inputs Outputs B A R Y G 0 0 0 1 1 0 1 1 b) Compare your results with truth table for design example 3 (aircraft preflight safety check) and comment on how well the logic system satisfies the design brief: 219

Exercise 6.5 1. A logic system has two input sensors A and B and three outputs. Output 1 is high when sensor A is low. Output 2 is high when sensor A is low and sensor B is low. Output 3 is high when sensor A is high and sensor B is low. a) Complete the truth table to satisfy these conditions. Truth table Inputs Outputs B A O/P 1 O/P 2 O/P 3 0 0 0 1 1 0 1 1 b) i) Examine the O/P 1 pattern. This can be generated from one of the input signals. Write down the logic function required to generate this output. ii) Examine the O/P 2 pattern. This can be generated from one of the standard logic gates. Write down the logic function required to generate this output. iii) Examine the O/P 3 pattern. This cannot be generated from the inputs using one of the standard logic gates. Write down the logic function required to generate this output. c) Draw the circuit diagram for the logic system. 220

2. A system is required that will monitor a car s cooling system. When the water level in the radiator is below a certain level a LED will light up. When the engine temperature is above a predetermined value and the water level is too low a buzzer should sound in addition to the LED lighting up. The positioning and signals out of the sensors used are shown below. Radiator A B Moisture Sensor Temperature Sensor Sensor A (moisture) state logic level Wet 1 Dry 0 Sensor B (temperature) state logic level Cool 1 Hot 0 a) Complete the following truth table for the system. Inputs Outputs B A LED Buzzer 0 0 0 1 1 0 1 1 b) Study the LED output and compare it with the inputs. What do you notice? c) Study the buzzer output. There is one type of gate that will provide this output pattern. What type of logic gate is required? d) Complete the following diagram showing how the system can be made up. 221

3. Before leaving port, the loading bay controller and captain of a car ferry carry out pre-departure safety checks. When all checks have been completed they each move a switch from the down to the up position. When both switches are down, a red indicator on the instrument panel is on. When any one of the switches is in the up position, the indicator light changes to yellow. When both switches are in the up position, a green indicator comes on. The engines of the car ferry can only be started when the green indicator is on. Assume that the switches provide logic level 0 in the up position and logic level 1 in their down position. The LED indicators operate on logic level 1. a) Complete the following truth table for the system. Inputs Outputs B A R Y G 0 0 0 1 1 0 1 1 b) Study the R output. There is one type of gate which will provide the required output. What type of gate is it? c) Study the Y output. Write down an expression to describe it. Y = d) Study the G output. There is one type of gate which will provide the required output. What type of gate is it? e) Complete the following diagram showing how the system can be made up. 222

4. Two sensors A and B are used to control the paint mixing process at a local DIY store. Three output valves control the flow of cyan, magenta and yellow pigment. Valve V1 is the cyan, Valve V2 is the magenta, and Valve V3 is the yellow. Mixing occurs according to the following sequence. A logic 1 operates the valve. Valve 1 operates when input A is high and input B is high. Valve 2 operates when input A is low and input B is low, or when input A is high and input B is low. Valve 3 operates when input A is low and input B is high, or when input A is low and input B is low. a) Complete the following truth table for the system. Inputs B A 0 0 V1 (cyan) Outputs V2 (magenta) V3 (yellow) 0 1 1 0 1 1 b) Which type of gate will provide the V1 output? c) Write down an expression to describe V2 and V3 by comparing them with the inputs. V2 =. V3 =. d) Draw the circuit for the system 223

NAND Gate Implementation Earlier on in this chapter we found out how to construct logic systems from a truth table. This often resulted in logic systems that required a number of different types of logic gate (e.g. NOT, AND and OR) in order to fulfil the function required. In some of the designs looked at we needed three different types of logic gate in the final design. As we have seen there could be as many as six identical logic gates in the IC package of which we are only going to use one. This is wasteful in terms of both unused devices and in the space needed on circuit boards. The inverted gates, NAND and NOR are special because the function of all other gates can be made from various combinations of NAND or NOR gates. In this course only NAND gate alternatives of the other logic functions will be discussed. By using just one type of logic gate we may be able to reduce the number of types of logic gate required to make any particular design. This has a number of advantages: There will be less confusion about which type of gate goes where in the circuit as they are all the same. There will be no need to keep stocks of all the different types of logic gate, therefore saving money. Larger quantities of a single type of gate can be purchased, which makes cost lower. We will now look at an example to show you how making this change can improve the situation. 224

Consider the two logic circuits below, which perform the same logic function. System 1: Mixture of gates. System 2: NAND gates only When system 2 is compared to system 1, you may think that we have made the circuit more complicated as we have more logic gates in system 2. However, in system 1 three different types of gates are required NOT, OR and AND. To construct system 1 using these gates would require three different logic ICs, and many of the logic gates on these ICs would not be used. Using system 2 requires four logic gates. Since these are all of the same type, only one logic IC would be required and all gates in the IC are used. This would provide a considerable cost saving compared to the design in system 1. In industry, if such systems are to be mass produced these savings can be considerable, and it is up to the engineers making the systems to use this technique to make the process as cost effective as possible. Now that we know why NAND gate logic is used let s find out how to carry out this procedure. We need to understand the combination of NAND gates required to replace each of our standard gates. 225

NAND gate equivalent circuits for the four other gates 1. The NOT gate This is the simplest of the standard gates to form from NAND gates. is the same as Check that you agree with the truth table below for the NAND equivalent circuit. Input Output A Q 0 1 1 0 Note: The NAND equivalent of a NOT gate is sometimes referred to as a NAND Inverter. You will need to remember this for later on. 2. The AND gate This is the inverse of a NAND gate, and is simply a NAND gate followed by an inverter (NOT Gate). Check that you agree with the truth table below for the NAND equivalent circuit. Inputs Intermediate Output Output B A X Q 0 0 1 0 0 1 1 0 1 0 1 0 1 1 0 1 226

3. The OR gate The OR gate is a little more complicated, and requires three NAND gates as shown below. Check that you agree with the truth table below for the NAND equivalent circuit. Inputs Intermediate Outputs Output B A X Y Q 0 0 1 1 0 0 1 0 1 1 1 0 1 0 1 1 1 0 0 1 4. The NOR gate The NOR gate is the inverse of the OR gate, so just one more gate is needed as shown below. Check that you agree with the truth table below for the NAND equivalent circuit. Inputs Intermediate Outputs Output B A X Y Z Q 0 0 1 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0 1 1 0 0 1 0 227

Converting Logic Diagrams to NAND gates The process for converting logic system diagrams into NAND gate format is quite straightforward if you work logically through the circuit. Each gate is replaced in turn by its NAND equivalent, and connected up in the same way. We will look at an example to show how this is done. Example 1: Convert the following logic system into NAND gates only. In this case we need to replace a NOT gate, OR gate and an AND gate. Stage 1: Redraw the NAND equivalent circuits of the gates shown above.where possible retain the position of these gates so that you can identify the connections afterwards. Drawing a box around each gate and its corresponding NAND equivalent will allow you to check that you have replaced every gate in the circuit. 228

Stage 2: It is then just a matter of connecting the equivalent circuits together. This circuit is now the equivalent circuit to that using a NOT, OR an AND gate given earlier. However, there is one further simplification we can make. Stage 3 : Consider the circuit again as shown below. 1 2 If you look carefully at the two NAND gates labelled 1 and 2, we can see that these are both configured to be inverters (or NOT gates). If we consider what happens to signal A as it passes through these two gates we have the following: A logic 1 at A, becomes a 0 after gate 1 and then a 1 again after gate 2 A logic 0 at A, becomes a 1 after gate 1 and then a 0 again after gate 2 Therefore, gates 1 and 2 serve no useful purpose in this circuit. They are known as redundant gates and can be removed. We call this double inversion and it occurs commonly when creating NAND gate circuits from other logic systems. Remember a double inversion only occurs when 2 NAND Inverters are directly connected to one another. 229

In a test or examination question you would usually be asked to cross out any redundant gates, so you would end up with the following circuit. Occasionally, you will be asked to redraw the circuit, with redundant gates removed, or if you were going to build the circuit then the final circuit would be as follows: We have methodically gone through this example to illustrate each stage of the simplification process. These steps can be reduced to just a few but there are a couple of things that will help to ensure that you don t make mistakes. Summary of process i. Identify each of the gates from the original circuit and their NAND equivalent. ii. Connect each equivalent NAND gate circuit as per the original diagram. iii. Identify and cross out any redundant gates caused by double inversions. iv. Do not try to remove double inversions in your head, as you can easily forget which ones you have done and leave some out. 230

Example 2: Convert the following logic diagram into NAND gates only. First of all we will replace all of these gates with their NAND equivalent and connect them together. Finally we check for any redundant gates, and identify these. Note the way in which different pairs of redundant gates are marked. 231

Investigation 6.5 1. a) Set up the following logic systems (which we looked at in example 1 earlier) on a simulation program and complete the truth table in each case for output Q. b) Redraw the NAND gate circuit above to include pull-down resistors, input switches and a LED indicator. Build the circuit on breadboard and complete the truth table. C B A Q 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 C B A Q 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 C B A Q 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 c) Compare the three truth tables to check you obtained the same result in each case. 232

Exercise 6.6 1. a) Redraw the following logic circuit using 2 input NAND gates only. b) Identify any redundant gates. 233

2. a) Redraw the following logic circuit using 2-input NAND gates only. b) Identify any redundant gates. 234