Digital Electronics Principles & Applications Seventh Edition Roger L. Tokheim Chapter 4 Using Logic Gates ©2008 The McGraw-Hill Companies, Inc. All rights reserved. INTRODUCTION • Logic Circuit from a Boolean expression • Minterm and maxterm Boolean expressions • Boolean expression from a truth table • Truth table from a Boolean expression • Simplifying Boolean expressions • Karnaugh mapping • NAND logic ©2008 The McGraw-Hill Companies, Inc. All rights reserved. INTRODUCTION (continued) • Data selectors and their use • Solving logic problems with data selectors • Using computer simulations • Variations in Boolean expressions • DeMorgan’s theorem • PLDs (programmable logic devices) • BASIC Stamp® modules ©2008 The McGraw-Hill Companies, Inc. All rights reserved. “Tools of the Trade” for Solving Logic Problems • Gate symbols • Truth tables • Boolean expressions Combinational logic circuits: AND-OR pattern of gates from AND-OR pattern of gates Sum-of-products Boolean expression such as: AB + CD = Y OR-AND pattern of gates from OR-AND pattern of gates Product-of-sums Boolean expression such as: (A+B) (C+D) = Y ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Logic Circuit From Boolean Expression Example: Draw the AND-OR logic diagram for the Boolean expression: AB + CD = Y Step 1: OR AB with CD Step 2: Add top AND gate Step 3: Add bottom AND gate ©2008 The McGraw-Hill Companies, Inc. All rights reserved. QUIZ Draw the OR-AND logic diagram for the Boolean expression: (A+B) • (C+D) = Y Step 1: Step 2: Step 3: ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Boolean Expressions Sum-of-products form: A•B + C•D =Y Also called the minterm form Product-of-sums form: (A + B) • (C + D) = Y Also called the maxterm form ©2008 The McGraw-Hill Companies, Inc. All rights reserved. QUIZ 1. The Boolean expression AB + BC = Y is in __________ (product-of-sums, sum-ofproducts) form. sum-of-products 2. The Boolean expression (A+B) (B+C) + Y is in __________ (product-ofsums, sum-of-products) form. product-of-sums 3. The Boolean expression (A+B) (B+C) = Y is in __________ (maxterm, minterm) form. maxterm 4. The Boolean expression AB + BC = Y is in __________ (maxterm, minterm) form. minterm ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Boolean Expression from Truth Table Write the Boolean expression that describes the logic in this truth table. Truth Table Input Output ABC Y 000 0 001 0 010 1 011 0 100 0 101 0 110 0 111 1 Step 1: Focus only on the truth table lines with outputs of 1. Step 2: AND the inputs for these two lines and logically OR the ANDed groups. A•B•C + A•B•C=Y Minterm Boolean expression: A B C + A B C = Y ©2008 The McGraw-Hill Companies, Inc. All rights reserved. QUIZ Truth Table Input Output ABC Y 000 001 010 011 100 101 110 111 1 0 0 0 0 0 0 1 Write the Boolean expression that describes the logic in this truth table. A•B•C + A•B•C=Y Minterm Boolean expression: A B C + A B C = Y ©2008 The McGraw-Hill Companies, Inc. All rights reserved. QUIZ Truth Table Input Output ABC Y 000 001 010 011 100 101 110 111 1. Write the sum-of-products Boolean expression for this truth table. ______________________________ A’BC + ABC = Y 0 0 0 1 0 0 0 1 2. Write the minterm Boolean expression for this truth table. ______________________________ A’BC + ABC = Y ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Truth Table From Boolean Expressions Fill in a truth table from a minterm Boolean Expression. Minterm Boolean expression: A•B•C + A•B•C + A•B•C = Y Step 1: Place three 1s in output column. Step 2: Place five 0s in blanks in output column of truth table. Truth Table Input Output ABC Y 000 001 010 011 100 101 110 111 1 0 0 1 0 0 1 0 ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Truth Table from Boolean Expressions Fill in a truth table from a minterm Boolean Expression. Minterm Boolean expression: Step 1: Place single 1 output column for term with three variables. Step 2: Place two 1s in output column for term with two variables. Step 3: Fill in 0s. A•B + A•B•C =Y Truth Table Input Output ABC Y 000 001 010 011 100 101 110 111 1 1 0 0 0 0 0 1 ©2008 The McGraw-Hill Companies, Inc. All rights reserved. QUIZ Truth Table Input Output ABC Y 000 001 010 011 100 101 110 111 1. Fill in the output column of the truth table for the Boolean expression A’B’C’ + ABC’ = Y. 1 0 0 0 0 0 1 0 ©2008 The McGraw-Hill Companies, Inc. All rights reserved. QUIZ Truth Table Input Output ABC Y 000 001 010 011 100 101 110 111 1. Fill in the output column of the truth table for the Boolean expression A’B’ + AB’C = Y. 1 1 0 0 0 1 0 0 ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Simplifying Boolean Expressions Truth Table Input Output ABC Y 000 001 010 011 100 101 110 111 1 1 0 0 1 0 1 0 Unsimplified Boolean Expression A•B•C + A•B•C + A•B•C + A•B•C = Y Thisline lineisisnot nottotobebeconsidered consideredininthe theloop. loop. This Simplified Expression: A•C + A•B = Y RULE: Eliminate term within loop that contains a term and its complement. ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Simplify Boolean Expression (Karnaugh map method) Unsimplified Boolean expression (3 variables): A•B•C + A•B•C + A•B•C + A•B•C = Y Step 1: Plot 1s _ _ AB Step 2: Loop groups Step 3: Eliminate variables Step 4: Form simplified minterm expression _ C C C 1 1 _ AB AB 1 _ AB 1 B C Simplified Expression: A C + A B = Y ©2008 The McGraw-Hill Companies, Inc. All rights reserved. QUIZ Simplify Boolean Expression (Karnaugh map method) Unsimplified Boolean expression (4 variables): ABCD + ABCD + ABCD + ABCD = Y Step 1: Plot 1s __ CD Step 2: Loop groups _ _ AB Step 3: Eliminate variables _ AB Step 4: Form simplified minterm expression AB 1 _ AB 1 B _ CD CD _ CD 1 1 D Simplified Expression: ACD + ABC = Y ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Developing a NAND Logic Diagram Minterm expression: AB + AB = Y Step 1: Draw AND-OR logic diagram from minterm expression. Step 2: Substitute NAND gates for each inverter, AND, and OR gate. NOTE: Both logic diagrams will generate the same truth table. ©2008 The McGraw-Hill Companies, Inc. All rights reserved. 1-OF-8 Data Selector Logic Symbol: Data Selector Data Inputs 0 1 2 3 4 5 6 7 W Output C B A Data Select Inputs ©2008 The McGraw-Hill Companies, Inc. All rights reserved. QUIZ What is the output from the data selector? 1-of-8 Data Selector Data Inputs 1 0 0 1 0 1 1 0 Data Select Inputs: 0 1 2 3 4 W 5 6 7 C B A ?HIGH HIGH LOWH 10 10 10 ©2008 The McGraw-Hill Companies, Inc. All rights reserved. QUIZ Use the data selector to perform the logic described in the truth table Truth Table 1-of-8 Data Selector C B A Y 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 1 0 0 1 0 1 1 0 1 0 0 1 0 1 1 0 0 1 2 3 4 W 5 6 7 C B A ? HIGH LOW 10 10 01 ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Circuit Simulation - Using the Logic Converter Conversion options Truth table area Boolean expression area Converts back and forth from Boolean expression, truth table, and Screen from Electronics Workbench® or MultiSIM® logic diagram ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Truth Table to Boolean Expression Step1: Click number of variables. Step2: Fill in truth table. Step3: Click truth table to Boolean expression conversion option. Unsimplified Boolean Expression appears here A’B’C+A’BC+AB’C’+AB’C+ABC ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Simplifying the Boolean Expression Step1: Click number of variables. Step2: Fill in truth table. Step3: Click truth table to simplified Boolean expression conversion option. Simplified Boolean Expression appears here AB’ + C ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Boolean Expression to Logic Diagram Step1: Type the Boolean expression. Step2: Click Boolean expression to logic diagram conversion option. Step3: Close Logic Converter window. AB’+C=Y is converted into this AND-OR logic diagram by the simulation software AB’ + C ©2008 The McGraw-Hill Companies, Inc. All rights reserved. QUIZ 1. A circuit simulator such as Electronic Workbench® or MultiSIM® contain a useful instrument called a __________ (logic converter, logic probe) used to convert back and forth from truth table to Boolean expression. 2. The logic converter instrument from Electronic Workbench® or MultiSIM® can convert back and forth from logic diagram to Boolean expression. (True or False) logic converter True ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Variations in Boolean Expressions Boolean expression (textbook style): A BA++CBD==YY A B=Y Boolean expression (keyboard style): A’B CD’ = Y (A+ + B)’ = A’ B’ = YY ©2008 The McGraw-Hill Companies, Inc. All rights reserved. QUIZ 1. The Boolean expression A B + C D = Y is written as _______ in keyboard style. A B’ + C’D = Y 2. The Boolean expression A+B+C = Y is written as _______ in keyboard style. (A+B+C)’ = Y 3. The Boolean expression A B C = Y is written as _______ in keyboard style. A’ B’ C’ = Y ©2008 The McGraw-Hill Companies, Inc. All rights reserved. DeMorgan’s Theorems First theorem: A+B=A B Both used to eliminate Second long overbars theorem: A B=A+B ©2008 The McGraw-Hill Companies, Inc. All rights reserved. DeMorgan’s Theorems First theorem: Second theorem: A+B=A B A B=A+B ©2008 The McGraw-Hill Companies, Inc. All rights reserved. DeMorgan’s Theorems START > A B=Y Step 1: Change all ORs to ANDs and all ANDs to ORs. A B=Y Step 2: Complement each individual variable (short overbar). A+B=Y Step 3: Complement the entire function (long overbar). A+B=Y Step 4: Eliminate all groups of double overbars. FINISHED (alternative NAND expression) (click to see final Boolean expression) A+B=Y ©2008 The McGraw-Hill Companies, Inc. All rights reserved. QUIZ 1. The statement A B = A + B is DeMorgan’s __________ (first, second) theorem and suggests converting from a NAND to an OR situation. 2. The statement A + B = A B is DeMorgan’s __________ (first, second) theorem and suggests converting from a NOR to an AND situation. second first ©2008 The McGraw-Hill Companies, Inc. All rights reserved. PLDs • Programmable Logic Device (PLD) - The generic name for an IC that can be programmed by the user to execute a complex logic function. • PLDs have many inputs and outputs. PLDs can be used to implement minterm Boolean expressions using AND-OR logic. More complex PLDs have latches and other memory devices. • PLDs have several advantages. PLDs are inexpensive, can be programmed by the user, and very reliable. ©2008 The McGraw-Hill Companies, Inc. All rights reserved. PLDs (continued) PLD is generic for a programmable logic device, but are also known by many other names including: • PAL - programmable array logic • GAL - generic array logic • FPL - fuse-programmable logic • PLA - programmable logic array • PEEL - programmable electrically erasable logic • FPGA - field programmable gate array • CPLD - complex programmable logic device ©2008 The McGraw-Hill Companies, Inc. All rights reserved. QUIZ 1. PLD is the generic name for a __________ (peripheral logic driver, programmable logic device) which is an IC that can solve logic problems. programmable logic device 2. PLDs commonly have many inputs but always have only one output. (True or False) False 3. PLDs have several advantages including they can be programmed in the local lab or school, are very reliable, and inexpensive. (True or False) True 4. Various manufacturers might refer to PLDs by acronyms like TTLs, CMOSs, PALs, ASCIIs, ASVABs, CPLSs, FPGAs, PEELs, or GALs. (True or False) False ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Programming Logic Functions using the BASIC Stamp® Module •One trend in electronics is the development of programmable ICs. •A second trend in electronics is the use of billions of inexpensive imbedded devices called microcontrollers. •A popular microcontroller used by schools is the BASIC Stamp® module, by Parallax, Inc. •BASIC Stamp® modules are programmable using a student-friendly version of B.A.S.I.C. •Solving a logic problem using a microcontroller (BASIC Stamp® 2 module) is detailed on the next slide. ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Using the BASIC Stamp® Module Truth Table Step 3: Disconnect PC from BS2 module INPUTS RED GREEN YELLOW Step 1: Write program on PC in PBASIC. AKey B lines C of code Y1 are: Y2 Y3 0 0Y1=(A&B&C)|(~A&~B&~C) 0 1 1 1 0 0Y2=(~A&~B)|(A&C) 1 0 1 1 0 1Y3=(~A)|(~B&C) 0 0 0 1 0 1 1 0 0 1 1 0 0 0 0 0 1 0 1 0 1 1 1 1 0 0 0 0 1 1 1 1 1 0 Logic Expressions in PBASIC: Y1= (A&B&C)|(~A&~B&~C) Step Download program from Step 4: Power OFF and ON (BS2 module). Y2= 2: (~A&~B)|(A&C) PC BS2 module. Manipulate andto observe outputs. Y3=inputs (~A)|(~B&C) Digital Inputs A Input AA==LOW Input LOW Input A =LOW HIGH Input B = Input B = LOW Input = LOW Input CCB ==LOW Input Input C =HIGH LOW B C Digital Outputs Y1 HIGH LOW LOW Y2 HIGH HIGH LOW Y3 HIGH HIGH LOW ©2008 The McGraw-Hill Companies, Inc. All rights reserved. QUIZ 1. The BASIC Stamp® module contains an inexpensive programmable IC called a _____. microcontroller 2. The BASIC Stamp® module is programmed using a version of B.A.S.I.C. on a _____ (modem, PC) and then downloaded into the BS2 module. PC (Personal Computer) 3. A BASIC Stamp® (such as the BS2 module) will always have many inputs but only one output. (True or False) 4. Programming the BASIC Stamp® module is done using an easy-to-use language called _____ (PBASIC, MICRO). False PBASIC ©2008 The McGraw-Hill Companies, Inc. All rights reserved. REVIEW • Logic Circuit from a Boolean expression • Minterm and maxterm Boolean expressions • Boolean expression from a truth table • Truth table from a Boolean expression • Simplifying Boolean expressions • Karnaugh mapping • NAND logic ©2008 The McGraw-Hill Companies, Inc. All rights reserved. REVIEW (continued) • Data selectors and their use • Solving logic problems with data selectors • Using computer simulations • Variations in Boolean expressions • DeMorgan’s theorem • PLDs (programmable logic devices) • BASIC Stamp® modules ©2008 The McGraw-Hill Companies, Inc. All rights reserved.