UNIT 2. Digital Signals: The basics of digital encoding and the use of binary systems.

Similar documents
Gates and Circuits 1

Logic diagram: a graphical representation of a circuit

Combinational Logic Circuits. Combinational Logic

CS302 - Digital Logic Design Glossary By

Department of Electronics and Communication Engineering

Digital Applications (CETT 1415) Credit: 4 semester credit hours (3 hours lecture, 4 hours lab) Prerequisite: CETT 1403 & CETT 1405

Digital Logic Circuits

Number system: the system used to count discrete units is called number. Decimal system: the number system that contains 10 distinguished

Lab# 13: Introduction to the Digital Logic

CS302 Digital Logic Design Solved Objective Midterm Papers For Preparation of Midterm Exam

Name: Class: Date: 1. As more electronic systems have been designed using digital technology, devices have become smaller and less powerful.

UNIT-IV Combinational Logic

EXPERIMENT 12: DIGITAL LOGIC CIRCUITS

Chapter 1: Digital logic

1.) If a 3 input NOR gate has eight input possibilities, how many of those possibilities result in a HIGH output? (a.) 1 (b.) 2 (c.) 3 (d.) 7 (e.

Digital Electronics Course Objectives

Gates and and Circuits

1. The decimal number 62 is represented in hexadecimal (base 16) and binary (base 2) respectively as

Electronics. Digital Electronics

COMBINATIONAL and SEQUENTIAL LOGIC CIRCUITS Hardware implementation and software design

Digital Electronics 8. Multiplexer & Demultiplexer

Due date: Sunday, November 8 (midnight) Reading: HH sections , (pgs , )

Digital Applications (CETT 1415) Credit: 4 semester credit hours (3 hours lecture, 4 hours lab) Prerequisite: CETT 1403 & CETT 1405

Asst. Prof. Thavatchai Tayjasanant, PhD. Power System Research Lab 12 th Floor, Building 4 Tel: (02)

EXPERIMENT NO 1 TRUTH TABLE (1)

Basic Microprocessor Interfacing Trainer Lab Manual

Laboratory Manual CS (P) Digital Systems Lab

COMPUTER ORGANIZATION & ARCHITECTURE DIGITAL LOGIC CSCD211- DEPARTMENT OF COMPUTER SCIENCE, UNIVERSITY OF GHANA

Chapter 4: The Building Blocks: Binary Numbers, Boolean Logic, and Gates

3.1 There are three basic logic functions from which all circuits can be designed: NOT (invert), OR, and

Practical Workbook Logic Design & Switching Theory

Schmitt Trigger Inputs, Decoders

LIST OF EXPERIMENTS. KCTCET/ /Odd/3rd/ETE/CSE/LM

16 Multiplexers and De-multiplexers using gates and ICs. (74150, 74154)

QUIZ. What do these bits represent?

COMPUTER ARCHITECTURE AND ORGANIZATION

LOGIC DIAGRAM: HALF ADDER TRUTH TABLE: A B CARRY SUM. 2012/ODD/III/ECE/DE/LM Page No. 1

Digital Fundamentals. Lab 4 EX-OR Circuits & Combinational Circuit Design

2 Logic Gates THE INVERTER. A logic gate is an electronic circuit which makes logic decisions. It has one output and one or more inputs.

Digital Electronics 1 (ET181) Laboratory Manual

2 Building Blocks. There is often the need to compare two binary values.

Lab 7 LEDs to the Rescue!

CSE208W Lecture #1 Notes Barry E. Mapen

ANALOGUE AND DIGITAL ELECTRONICS STUDENT S WORKBOOK U3: DIGITAL ELECTRONICS

SRV ENGINEERING COLLEGE SEMBODAI RUKMANI VARATHARAJAN ENGINEERING COLLEGE SEMBODAI

Function Table of an Odd-Parity Generator Circuit

A New, Low-Cost, Sampled-Data, 10-Bit CMOS A/D Converter

Odd-Prime Number Detector The table of minterms is represented. Table 13.1

Analog-to-Digital Conversion

Lab 2: Combinational Circuits Design

DIGITAL ELECTRONICS: LOGIC AND CLOCKS

E85: Digital Design and Computer Architecture

DIGITAL ELECTRONICS. Methods & diagrams : 1 Graph plotting : - Tables & analysis : - Questions & discussion : 6 Performance : 3

ELECTRICAL ENGINEERING - TEACHER MODULE 1 LOGIC GATES

COMBINATIONAL CIRCUIT

Experiment 5: Basic Digital Logic Circuits

Spec. Instructor: Center

LOGIC GATES AND LOGIC CIRCUITS A logic gate is an elementary building block of a Digital Circuit. Most logic gates have two inputs and one output.

Module 4: Design and Analysis of Combinational Circuits 1. Module-4. Design and Analysis of Combinational Circuits

R & D Electronics DIGITAL IC TRAINER. Model : DE-150. Feature: Object: Specification:

Chapter 4 Combinational Logic Circuits

ANALOG TO DIGITAL CONVERTER

Lecture 15 Analysis of Combinational Circuits

University of Technology

B.E. SEMESTER III (ELECTRICAL) SUBJECT CODE: X30902 Subject Name: Analog & Digital Electronics

DIGITAL ELECTRONICS QUESTION BANK

Lab 6. Binary Counter

Subtractor Logic Schematic

Chapter 2: Your Boe-Bot's Servo Motors

Page 1/10 Digilent Analog Discovery (DAD) Tutorial 6-Aug-15. Figure 2: DAD pin configuration

Logic Families. Describes Process used to implement devices Input and output structure of the device. Four general categories.

Physics 335 Lab 1 Intro to Digital Logic

Winter 14 EXAMINATION Subject Code: Model Answer P a g e 1/28

Breadboard Primer. Experience. Objective. No previous electronics experience is required.

Chapter 4 Combinational Logic Circuits

EK307 Lab 3 Spring Lab Assignment 3 Logic Gates

Unit 1 Foundations in Electronics - Lesson 1.1 Introduction to Electronics Standards Essential Question Enduring Understandings

Exercise 1: AND/NAND Logic Functions

MSI Design Examples. Designing a circuit that adds three 4-bit numbers

Lab Exercise 6: Digital/Analog conversion

ENGR 210 Lab 12: Analog to Digital Conversion

UNIT III. Designing Combinatorial Circuits. Adders

Positive and Negative Logic

ENG 100 Electric Circuits and Systems Lab 6: Introduction to Logic Circuits

Fan in: The number of inputs of a logic gate can handle.

Objective Questions. (a) Light (b) Temperature (c) Sound (d) all of these

Lab 5. Binary Counter

ENGINEERING TRIPOS PART II A ELECTRICAL AND INFORMATION ENGINEERING TEACHING LABORATORY EXPERIMENT 3B2-B DIGITAL INTEGRATED CIRCUITS

BCD Adder. Lecture 21 1

Design and build a prototype digital motor controller with the following features:

Code No: R Set No. 1

INTRODUCTION. Figure 1 Three-terminal op amp symbol.

Lecture 02: Digital Logic Review

Digital Imaging Rochester Institute of Technology

300 in 1 Electronic Project Lab Science Fair. Tandy / RadioShack. ( ) Included Projects

Chapter 3 Describing Logic Circuits Dr. Xu

11 Counters and Oscillators

EE2304 Implementation of a Stepper Motor using CMOS Devices Fall 2004 WEEK -2-

In this lecture: Lecture 3: Basic Logic Gates & Boolean Expressions

Lab 12: Timing sequencer (Version 1.3)

Transcription:

UNIT 2 Digital Signals: The basics of digital encoding and the use of binary systems. Your Name Date of Submission CHEMISTRY 6158C Department of Chemistry University of Florida Gainesville, FL 32611 (Note: Much of the material in this handout was rewritten/updated in 2001 by graduate student Andrew K. Ottens.) Page 1

Introduction In the previous unit we examined analog signals and the use of transducers to encode electrical information. This unit will cover digital signals, most often used by computers and other integrated circuits to encode information. Since most instruments today manipulate information via digital processes, it is important to learn what it means to be digital, and the basics regarding digital logic. What is digital? Say the word digit, and you think of numbers and counting. In the digital world we deal with discrete integers, whole number values. To sum up digital, think of signals as specific values; on/off, true/false, 1/0. A light switch is digital in nature. The switch is up, and the light is on. When the switch is down, the light is off. There isn t a middle value with a conventional light switch. It s the same way with digital encoding. This is completely different from analog, which could be looked at as a dimmer switch. The light level is not encoded as on or off, but as many variable values between the two extremes of on and off. You might think that you can get more detail with an analog signal, since there are many possible values. In some sense this is correct. Theoretically, the dimmer switch can supply many more values than the on/off switch, but there is good reason why computers are digital in nature. The transistor, first produced by Bell Labs in 1949, is the light switch of the electronics world. Transistors are solid state components that can turn on or off depending on input signals received. Each transistor acts as an on/off, or 1/0 switch, and if you put a lot of them together, you get many more possibilities. All of a sudden you have similar detail from a digital device as you do from an analog equivalent, only smaller, more consistent and much more versatile. One of the most obvious uses of transistor technology is in your computer. Today it s not uncommon to find tens of millions of transistors on a single silicon wafer 0.5 inches square. But the beauty of a microprocessor is its ability to be programmed. You can get a computer to do just about anything, because software can be used to reconfigure the transistors in many ways. Most analog technology is hardwired it cannot learn new tricks. Basics In the last unit we discussed electrical quantities: voltage, current, charge, and power. Digital signals are often electrical in nature. However, when looking at an analog signal we looked at the magnitude of the electrical quantity. For example, we concerned ourselves with the output voltage of the photoresistor. We observed the variable values when covering up the photoresistor. However, with digital information we are often only concerned with the state of the signal, not its magnitude. Most often we have two states, Hi or Lo, On or Off, 1 or 0. With electrical components however, we define what is considered a Hi state or a Lo state. Transistor circuits set Hi values as a voltage value ranging from 2.0V to 5.0VDC. The Lo state is set between 0V and 1.2V. These set points are characteristic of the electronics used, but the general idea is that if you detect a Page 2

voltage value of near zero voltage the value is said to be Lo, and up near five volts it s said to be Hi. Digital signals can be more complicated than Hi or Lo. In fact, you can use any number of discrete values to encode digital information. For example, when you count your fingers you are using digital encoding. Each digit can be one of ten values, 0-9. This is counting in decimal; something we are all very comfortable with. However, since transistors generally have two possible states, computer systems count in binary, 0 or 1 (2 9 do not exist in the binary realm). We don t normally think in binary, but it s fairly simple. Each digit can be either 0 or 1. String multiple digits together, and you get more possibilities. We refer to a binary digit as a bit. Two binary digits are considered two bits. The number of possible discrete values encoded by two bits is 2 2, four. So if you have four bits, you would have 2 4 or 16 possible values (0 15 in decimal). You can use Table 1 to help visualize counting in binary. Page 3

On the left you can see the decimal value. On the right is the least significant bit, LSB, of the binary number, which is the first binary digit in the 4 bit word. If you use four bits, you start with 0000 and then increment the LSB one value to 0001. Continue to increment, and you get 0010, 0011, 0100, etc. (The convention for binary numbers has the LSB on the right, so you increment from right to left as is done in decimal.) Hands On Digital Encoding - Locate the binary switch job board (BSI) shown in figure 1. Plug the BSI job board into the breadboard frame. Using figure 1, locate the output sockets. They are labeled A-MB, and are linked to the ten switches. Using a 24 awg. wire connect the direct output socket of switch A to a P1 socket (refer to figure 1). Figure 2 shows the switch layout of the BSI job board. A - H are toggle-hold switches, while MA and MB are momentary switches. Momentary switches stay down only if you hold them. Page 4

Using two banana cords, plug the handheld DMM into P1 and Common at the top of the breadboard frame. Set the DMM to voltage DC mode, and power on the breadboard frame. Record the voltage reading in the table below. Now toggle switch A up and record the voltage value in the table below. (Note you should see distinct high and low voltage reading when toggling A. If you don t, your BSI board could be faulty consult your TA.) Now move the 24 awg. wire to the inverse output of switch A. Record the voltage values for each state below. Output Direct Outputs Inverse Outputs State of Switch Down Up Down Up Voltage Reading Take a close look at the BSI board. Just behind the panel of switches are four chips (integrated circuits or ICs). Read the labels on the chips, and you will see that all four of them are 7404 (or equivalent 7414) chips. Remember this number, because we will come back and explain exactly what a 7404 chip does. For now, realize that the switches act as binary information generators, and the chips process the information and relay whether the switch is set Hi or Lo. The physical switch mechanism can be thought of as a digital input transducer. Question 1: Give an example of a digital information generator used in your lab. What are the functions of each position of the device? We also have digital output transducers on the BSI job board. Looking at figure 1, on the left end of the board you will find a row of red light emitting diodes (LEDs). An LED converts digital information in the electrical domain to digital information in the physical domain. See what happens if you wire the direct output of switch A to the input of LED A. With the breadboard frame powered, toggle switch A up and down. Record what happens in the table below. Wire the LED to the inverse output, and record observations below. Output Direct Outputs Inverse Outputs State of Switch Down Up Down Up State of LED A The key thing to remember about digital information is that there is always a discrete value, for example the LED is always on or off, the switch is always up or down. The digital domain doesn t accommodate values in between discrete states. You can hold the switch between up and down, but digital electronics always decide one way or the other if the switch is up or down even if physically it is neither. Page 5

Question 2: Come up with two examples of uses of LEDs. Explain what significance is related to each state of each LED. Question 3: Can a photoresistor like the one you worked with in Unit 1 be used as a digital transducer? What type of transducer is it, input or output? Describe how the photoresistor might encode digital information. Come up with a possible example of using a photoresistor as a digital transducer. Counting in Binary with the BSI - So far we have limited our digital encoding to one bit of data (one switch or one LED). However, we couldn t go very far in the digital realm if we were limited to only one bit. The BSI board can encode more than one bit, and we will use it to learn how to count as a computer does. Question 4: How many possible bits does the BSI job board have if all front panel switches are used? Using that number of bits, how many possible combinations can you get? Question 5: How many decimal digits would it take to have as many possible states as you found in question four? How many possible states can you have with this number of decimal digits? We will now use switches A-D to give us four bits of digital data. With four bits we have 16 possible states, starting with all switches down (if necessary, look back at table 1 to help visualize). Wire the direct output sockets of switches A-D to LEDs A-D (A to A, B to B, etc.). Set all switches to the down position, and turn on the breadboard frame. Flip switch A up, and LED A should light. A is the LSB, and in the up position it indicates 0001 in binary (1 in decimal). Now using table 1, flip the switches Hi/Lo in the patterns necessary to count from 0000 to 1111 in binary (0 to 15 in decimal). Question 6: Looking at figure 3, what value is indicated? Report both in binary and decimal. Binary-Coded Decimal (BCD) - Computers count in binary, we count in decimal. Therefore, there is a need for some means of converting between these two counting Page 6

systems. This is performed by microchips designed specifically to take binary numbers and convert them into decimal values. This concept is called Binary-Coded Decimal (BCD). In the decimal system, one digit has ten possible states (numbers 0-9). So we need enough bits to handle ten discrete possibilities. We know one bit has two possibilities (0,1), two bits have four (00, 01, 10, 11), three bits have eight, and four bits have sixteen possible combinations. Sixteen is greater than ten, so we can use four binary digits (bits) to count as high as one digit in decimal. The chip we will use to perform the BCD conversion is a 7447 decoder chip located in the upper right corner of the ELVIS II breadboard. The 7447 chip takes four bits of information via four input points, then processes the information into a decimal number. The decimal number is routed to seven outputs designed to work with a seven-segment display. Figure 4 shows the pin assignments for both the 7447 and the digital display. Note also that the output of the 7447 is not five volts, but is rather a connection to common (Lo value of zero volts). 100Ω resistors must be used to restrict the flow of current coming from the display (always kept at 5V) to the 7447 chip when a Lo signal is generated. Current flows from the digital display through the resistor to the 7447 chip and then to common. The end result is that the LEDs of the display become lit when the 7447 connects selected segments to common. (Aside: Counter to intuition, the signal being used to trigger an event may be a change going from Hi to Lo. It is important to know what transition is occurring to be able to use the chip properly and not damage your component. To distinguish between the two possibilities we say that the component is active Hi or active Lo. If the component triggers when going from 0V to 5V it is an active Hi component. Active Lo components trigger when going from 5V to 0V.) Locate the seven-segment display and the 7447 chip on the ELVIS II breadboard and inspect it (or other integrated circuits on the breadboard) without removing any of the wires or components. Some chips have seven connections on each side and others have Page 7

eight. Generally, the number of connections varies, but often you will have the same number on each side. Typically the connections are numbered by going counter clockwise around the chip. To find pin 1, start by looking at the top of the chip. Some will have a little dot in one of the four corners marking pin 1. Others will have a tab at the top. Orient the chip so that the notch is facing up, and pin 1 will be just to the left of the notch as shown in figure 5. Once you find pin 1, count down the left row of pins until you reach the bottom (for example the 7447 chip will have pins 1-8 on its left side). Then you cross over to the right side, and start counting from the bottom up. The actual function of each pin depends on the chip. You can usually find out the pin assignment and other detailed information about a chip by looking at the manufacturer s website, or a data book. (The electronic shop keeps copies of older data books for reference. For newer chips you will need to refer to a website.) Also remember that two pins must always be used to power the chip. In many cases you will use five volts and common, but not always. Make certain that you know what you re doing before wiring an integrated circuit (IC). You can easily damage an IC by mis-wiring. Be careful to plug wires into the correct location and you should have no problems. Make sure the ELVIS II breadboard power is off. Run a wire from ground to pin 3 of the 7447 chip (shown as Lamp test in figure 4). Power on the breadboard. You should see the number 8 (all seven segments should be lit up). Question 7: Why do you think they include a Lamp test contact point? Which component are we really testing? Shut off the breadboard power, and wire one each of the four holes next to DIO 0, DIO 1, DIO 2, and DIO 3 just to the upper right of the breadboard to the input sockets A, B, C, and D, respectively, of the 7447 (look at figure 4 for pin assignment). Before you continue, make certain that all of the wires are in the correct location (ask a TA if unsure). Turn on the breadboard power and launch the Digital Writer program (labeled DigOut on the NI ELVISmx Instrument Launcher toolbar.) Make sure all switches on the screen are in the down position and that outputs 0-7 are selected in the box on the screen. Question 8: What decimal value do you read? What is the binary value (all four bits)? Toggle switch 0 on the computer screen up, then toggle through the binary numbers up to 1111 (refer to table 1 if necessary), using switches 0-3. Page 8

Question 9: What is the highest decimal number you can generate on this display, and what is the binary equivalent needed to produce this decimal number? Question 10: If we use four bits, we have 16 possible combinations. How many of these possibilities are not used by the 7447 chip? What does the chip display when you input the binary number 1100? Computer controlled digital input/output terminals There is also a Digital Reader program (DigIn on the NI ELVISmx Instrument Launcher toolbar). Eight lines of either input or output are used at a time in these programs because computer digital ports are segmented into eight individual bits, each of which is called a digital channel. (Aside: Eight bits is a very common amount known as a byte. When computer systems were first being developed it was decided that information would be packed into eight bit chunks - so the byte came to be. When you look at the amount of storage room left on your floppy disk or hard drive, you are looking at how many kilobytes (kb) or megabytes (MB) are left.) The virtual switches (0 7) on the screen of the Digital Writer program output Hi/Lo values dependent upon their position (up/down) just as the physical switches on the BSI job board did. A virtual LED above the virtual switch turns light blue when the switch is set to a Hi value. With the Digital Reader program each virtual LED turns light blue when a Hi value is being input to the program for a device or other program. This is similar to the LEDs of the BSI job board which light up when triggered Hi. It is very easy to damage digital channels. BE VERY CAREFUL. Make certain you use the correct terminal and do not connect a channel to something else such as the metal case of the breadboard frame, or another output source. The best way to protect the hardware is to connect a wire at both ends before moving on to the next wire. DO NOT LEAVE WIRES DANGLING FROM THE BREADBOARD HOLES. Wiring the BSI job board to the Digital Reader and Writer Programs - Connect DIO 0 to LED A (remember to attach the ground on the NI ELVIS II breadboard to ground on the green breadboard frame). Next wire the direct output socket of switch A of the BSI job board to DIO 8. Make certain all switches are in the down position. Turn on the power to the ELVIS II breadboard and the green breadboard frame. Then launch the Digital Writer and Reader programs. You should already have noted that these programs do not run automatically when opened: you must start them by clicking the run arrow on the window. LED A on the BSI job board and virtual LINE STATE 8 LED should be off with BSI switch A and virtual switch 0 in their down positions. Flip up switch A on the BSI job board and the LINE STATE 8 LED should light up on the screen. Click on the virtual switch 0, and LED A should light up on the BSI job board. You can see the similarity between the virtual and physical binary switching systems. Now stop the programs (hit stop), and turn off the power to the ELVIS II breadboard and the green breadboard frame. Disconnect the wires one at a time; make certain that you Page 9

disconnect the ground wire last. We will be moving on to more complex digital circuits, but the wiring techniques covered so far will continue to apply. The point, BE VERY CAREFUL, and you will not accidentally destroy hardware. Digital circuits can be very delicate; the care you are taking in class should also be applied to any digital circuits you may service on your own. Digital Logic We will now cover the basic logic circuits used in digital systems. In lecture you were introduced to various logic gates. Here we will use microchips that perform digital logic with Hi/Lo signals. For reference, use the digital logic chapter in your text. Truth Tables We talked previously about active Hi and active Lo devices. mind that digital circuits commonly use the following relationship: Keep in +5V = Hi, 0V = Lo Every other assignment to the digital state is dependent on the logic you are using. Conventionally we say a Hi state can be represented by 1, On or True, and a Lo state is 0, Off or False. This however, depends on whether you are using active Hi or active Lo logic. Below are two tables, each with a truth column; one is for active Hi logic and the other is for active Lo logic. Take a look, and get accustomed to converting between signal levels and truth statements. Active Hi Table Signal Level Associated Number Associated Function Associated Logic Statement Hi ( +5V ) 1 On True Lo ( 0V ) 0 Off False Active Lo Table Signal Level Associated Number Associated Function Associated Logic Statement Hi ( +5V ) 0 Off False Lo ( 0V ) 1 On True The above tables illustrate that if you have an active Hi device and you receive a Hi value the signal can represent the numeric value 1, indicate the device is On, or that the logic statement is True. The opposite applies for active Lo devices. AND Function The AND logic function compares a group of input signals, and outputs a Hi value only when all of the inputs are Hi. In other words, with a two bit input, both bit one AND bit two have to be Hi in order for the output of the logic function to be Hi. All other combinations results in a Lo output. This is illustrated in the following table. Page 10

Bit 1 Lo Hi Lo Hi Bit 2 Lo Lo Hi Hi Output Lo Lo Lo Hi The 7408 logic chip performs the AND function. Locate the basic gates job board (shown in figure 9). Find the 7408 chip on the lower right side of the ELVIS II breadboard. The 7408 contains 4 independent 2-input AND gates represented by the AND symbol found in figure 6. You can see the pinouts for the four AND gates in figure 7. (Aside: The actual digital logic processes are termed logic functions. The IC component that performs a logic function is termed a logic gate.) Note that 1 and 2 are the inputs in figure 6, and the 3 is the output of the logic gate. Page 11

With all of the DIO lines disconnected, start the Digital Writer and Reader programs. Make sure the Writer program is set to use Lines 0-7, and the Reader program Lines 8-15. Then stop both of the programs and turn off the ELVIS II breadboard power. Using one of the AND gates of the 7408 chip, wire DIO 0 and DIO 1 to the inputs of that AND gate. Then wire the output of that AND gate to DIO 8. Turn on the breadboard power, and start the Digital Reader and Writer programs. Toggle DIO 0 and DIO 1 through the values shown in the following table. Fill in the state information of virtual LINE STATE 8 LED and answer the logic statement Virtual LINE STATE 8 LED is lit (True or False). (As a reminder, always stop the PC Digital Reader and Writer programs and shut off the breadboard power after each use.) DIO 0 State DIO 1 State Virtual LINE STATE 8 LED State Lo Lo Hi Lo Lo Hi Hi Hi Truth Statement The 7408 is an active Hi component meaning a Hi signal is interpreted as a True condition or a 1, and Lo signal is translated as a False condition, or a 0. We use truth tables to make sense of the signals. Use the above information to fill in the truth table for the 7408 AND gate below. DIO 0 is Hi (true or false) DIO 1 is Hi (true or false) LINE STATE 8 LED is Hi (true or false) Logic functions are used in electronics to control the behavior of various components. We use truth tables to relate the real world situations to the electronic signals. Let s say you had the situation where you wanted a security light to turn on outside your house when it was dark AND motion was detected in the area. You could use a photoresistor circuit to determine if it was day or night, and you could use an IR motion detector to monitor movement outside of your home. From this information you can create the following truth table. It is Night Time Something is Moving The Security Light is On False False False True False False False True False True True True Page 12

Now consider the operation of the photoresistor used in Unit 1. You received a Hi signal (nearing 5V) when light entered the entire photoresistor. This is the opposite of what we need to use the above truth table. In other words, the photoresistor is an active Lo device for monitoring night time; a Lo (0V) signal indicates night. We thus need to invert the signal coming from the photoresistor to use it with an AND gate. NOT Function We indicate the NOT gate via the symbol shown in figure 8. The NOT function inverts its input signal. If you feed a Hi signal into point 1 you get a Lo signal out of point 2. The NOT function is performed with the 7404 hex inverter chip (remember that we looked at 7404s on the BSI job board, now you know what they do). Looking at figure 9 you can see that there are six (hex) NOT gates on the 7404 chip. Wire DIO 0 to the input of one NOT gate on the 7404 chip (located on the basic logic gates job board). Wire its output to DIO 8. Turn on the breadboard power, and run the Digital Reader and Writer programs. Toggle DIO 0, and record the state of the Virtual LINE STATE 8 LED in the table below. Page 13

DIO 0 State LINE STATE 8 LED State LED is On (true/false) Hi Lo The NOT, or inverse of a statement, is expressed by a bar over the statement. In other words the statement Ā means NOT A. You will see this format used often in digital circuits, so keep this in the back of your mind. Referring to the schematic below, wire DIO 0 and DIO 1 to inputs of two NOT gates on the 7404 chip. Take the outputs of the two NOT gates and wire them to the inputs of an AND gate on the 7408 chip. Wire the output of the 7408 AND gate to DIO 8. Fill in the table below with the possible states of DIO 0 and DIO 1, and the resulting value for DIO 8 (as indicated by LINE STATE 8 LED) DIO 0 State DIO 1 State DIO 8 State Question 11: In the above experiment we used inverters before an AND gate. What would happen if you placed an inverter after the AND gate, not before it? Draw a table showing what the state values would be for DIO 0, DIO 1, and DIO 8. Question 12: Using the NOT function and the AND function draw a schematic that would be used to take the active Lo signal from our photoresistor and the active Hi signal from our motion detector, and output the result to a security light. Use the symbols you ve learned for both functions, and the symbol for a photoresistor (refer to Unit 1). For the motion detector draw a box and write motion sensor in it. Draw a light bulb to indicate the security lamp. Include a state table. OR Function The last of the basic functions is OR. As the name implies, an OR gate will pass a Hi value when either input 1 is Hi OR input 2 is Hi, and also when both inputs are Hi. The state values for an OR gate are shown below. Page 14

Input 1 Input 2 Output Lo Lo Lo Hi Lo Hi Lo Hi Hi Hi Hi Hi If you wanted to install a fire alert system you would want to account for both a rise in temperature and the presence of smoke. Thus, the alarm should ring when a heat sensor is triggered OR when a smoke sensor is triggered OR both are triggered at the same time. Using this information fill in the truth table below. The first column should be a statement referring to the temperature of the room, the second column should refer to smoke being in the room, and the last should be a statement referring to the alarm (come up with truth statements for each and input them in the first row). The symbol for an OR gate is shown in figure 10. A 7432 chip contains four OR gates. The pinout of the 7432 chip is shown in figure 11. Page 15

Using one OR gate of the 7432, wire DIO 0 and DIO 1 to its inputs, and DIO 8 to its output. Fill in the state table below with your observations. DIO 0 State DIO 1 State DIO 8 State Lo Lo Hi Lo Lo Hi Hi Hi Question 13: Assuming that the heat and smoke detectors are active Hi components, draw a schematic using the OR function of the fire alert system. Use boxes with text in them to illustrate the input transducers and the output transducer. Integration of a NOT gate with an AND gate and with an OR gate Very often we use the basic functions AND and OR with a NOT function. Combining an AND gate s output with a NOT gate is called a NAND gate. In actuality, the NAND gate was developed before the AND gate. However, it makes sense to use a NAND gate in those situations when they are needed rather than using an AND and a NOT gate. An OR gate combined with a NOT gate is called a NOR gate. Figure 12 shows the symbols for both NAND and NOR gates. Notice that a circle at the output end of the symbol is used to designate the presence of an inverter function. There are two types of NAND gates on the ELVIS II breadboard. The 7400 chip contains four 2-input NAND gates while the 7420 has two 4-input NAND gates as shown by the pinouts in figure 13. Page 16

Starting with the 7400, wire.dio 0 and DIO 1 as inputs, and DIO 8 as an output. Fill in the 7400 state table below, using the LINE STATE 8 LED as an indicator of the value of DIO 8. Then use DIO 0 DIO 3 as inputs for the 7420, and DIO 8 as an output. Fill in the 7420 table, again using the LINE STATE 8 LED in the Digital Reader program as an indicator. Two input NAND Gate (7400) Four Input NAND Gate (7420) DIO 0 Inputs Output Inputs Output DIO 1 DIO 8 DIO 0 DIO 1 DIO 2 Lo Lo Lo Lo Lo Lo Lo Hi Lo Lo Lo Hi Hi Lo Lo Lo Hi Lo Hi Hi Lo Lo Hi Hi DIO 3 Lo Hi Lo Lo Lo Hi Lo Hi Lo Hi Hi Lo Lo Hi Hi Hi Hi Lo Lo Lo Hi Lo Lo Hi Hi Lo Hi Lo Hi Lo Hi Hi Hi Hi Lo Lo Hi Hi Lo Hi Hi Hi Hi Lo Hi Hi Hi Hi DIO 8 Similarly, investigate the table of states for the 7402 quad 2-input NOR gate (pinout is shown in figure 14). Page 17

DIO 0 Inputs 7402 NOR Gate DIO 1 Output DIO 8 Question 14. For the 2-input NOR gate, write a truth table (true/false) for the response observed for active low input signals (be sure to include truth statements. Ex., switch is up). Question 15. If only a NAND or NOR gate is available and the NOT function is needed, how could you connect these gates to achieve the NOT function? Hint: What function is performed when the same signal is applied to both inputs? Question 16. In a chemical process it is desired to sound a warning buzzer under the following conditions: (the ph of the reaction mixture is outside the range ph 4-8 and the temperature of the mixture exceeds 50 C) or (the stirring motor is not turning). The following signals are available. 1. ph sensor output (Lo=pH OK, Hi=pH too high or too low) 2. Temperature sensor output (Lo=temp OK, Hi=temp>50 C) 3. Stirring motor signal (Lo=ON, Hi=OFF) Use logic gates to generate a logic level signal that is Hi when the warning buzzer should sound and Lo when it should not. Show the circuit and the truth table. (Boolean algebra may help to simplify your circuit.) We ve covered some of the basic logic functions available: AND, NAND, OR, NOR and NOT. Although individual chips are available for all of these functions, if one is not available, most any function can be performed with a combination of other gates. This is demonstrated below. Using the logic chips on the ELVIS II breadboard, show that the three AND gate circuits in figure 15 (a, b, c) are equivalent, and that the two OR circuits in figure 16 (a, b) are equivalent. Logical equivalence is demonstrated by identical tables of states. A B (a) Page 18 M

A B (b) M A B M (c) Figure 15: Various setups to perform the AND function Table of States for Figure 15 DIO 0 DIO 1 DIO 8(a) DIO 8(b) DIO 8(c) C A M B Connect C to a digital output which is set HI (a) A B (b) M Figure 16: Various setups to perform the OR function Page 19

Table of States for Figure 16 Inputs Outputs DIO 0 DIO 1 DIO 8(a) DIO 8(b) Figure 17 shows an AND-OR-INVERT (AOI) gate. Implement this with two AND gates and one NOR gate. Record the table of states below. A B C M D Figure 17 Table of States for Figure 17 Inputs Output DIO 0 DIO 1 DIO 2 DIO 3 DIO 8 Page 20

The AOI function can be implemented using a variety of other gate combinations. In fact it can be done with four NAND gates. You could spend the next few hours trying to figure out how to do this but instead, understand the concept that a LOGIC FUNCTION can be implemented with a variety of different LOGIC GATE combinations. Question 17: Think of situation where you would use an AOI function. Describe the input devices, and what is being driven by the output value. Write a truth table for the situation you come up with. Exclusive-OR Gate and Digital Comparators We will investigate the Exclusive-OR (XOR) function (Figure 18) in its gate and comparator forms. We will observe the tables of states for the 7486 and 7485 devices and relate these to the desired logic operations. The 7486 quad, 2-input Exclusive-OR gate is shown in Figure 19. Wire up the 7486 chip using the pinout information present in the figure. Determine the table of states for one of the XOR gates. Record your data as Lo and Hi. A B 7 4 8 6 Figure 18 M Figure 19: 7486 Exclusive-OR gate Page 21

State Table for Figure 18 Inputs Output DIO 0 DIO 1 DIO 8 Question 18: Using a 7400 and a 7402, suggest a circuit that would perform the Exclusive-OR function. Hint: Look on p. 161 of the textbook. Remember the bar over the signal indicates an inverted signal. Equality Function - The equality or coincidence function can be implemented by inverting the output of the Exclusive-OR gate. Implement this with one 7486 gate and one 7404 inverter. Wire DIO 0 and DIO 1 as inputs and DIO 8 as an output. Fill in the table of states below. State Table for Equality Gate Inputs Output DIO 0 DIO 1 DIO 8 Wire the four-bit equality detector (digital comparator) shown in Figure 20. Create the 4 equality gates with Exclusive-OR gates and inverters. The four-input AND gate can be implemented with one 7420 and an inverter. Use DIOs 0-3 and 4-7, respectively, for words A and B, each of which is four bits long. Show that the equality condition is indicated at the output only when all four bits of the two digital words are equal. Try the combinations suggested in the table and others if you want. Page 22

Figure 20 Table of States for Figure 20 Inputs: Word A Inputs: Word B Output DIO 3 DIO 2 DIO 1 DIO 0 DIO 7 DIO 6 DIO 5 DIO 4 DIO 8 L H H L L H H L L H L L L H H L L L H L L H H L The 7485 magnitude comparator is a medium scale integrated circuit (MSI chip). Its pinout is shown in figure 21. It performs a magnitude comparison of binary and BCD coded digital words. The 7485 comparator is also located on the ELVIS II breadboard. Use the various A and B input words shown, and fill in the table of states. Use the connections shown in the following table. Page 23

Figure 21: 7485 4-bit Comparator Digital Writer Program 7485 Digital Writer Program 7485 Digital Reader Program 7485 DIO 0 A0 DIO 4 B0 DIO 8 A>B DIO 1 A1 DIO 5 B1 DIO 9 A<B DIO 2 A2 DIO 6 B2 DIO 10 A=B DIO 3 A3 DIO 7 B3 Input Word A Input Word B Outputs DIO 3 DIO 2 DIO 1 DIO 0 DIO 7 DIO 6 DIO 5 H L H H H L H L H L H L H L H H DIO 4 H H L L H H L L A > B A < B A = B Page 24

Question 19: What happens if you connect the A = B output, the A > B output and the A < B output to one of the four input holes (just to the lower right side of the breadboard) for LEDs 0, 1, and 2, respectively, instead of to DIO 8-10? Question 20: Describe the logic in the comparator chip that is needed to obtain the A = B output, the A > B output and the A < B output. Refer to p.163-165 of the textbook. Logic Operations We will explore the operation and implementation of the mediumcomplexity logic operations such as adding, decoding, and multiplexing. We will wire these operations with combinations of basic gates and special-purpose MSI logic IC's on the ELVIS II breadboard. Wire the half-adder circuit shown in Figure 22 using an AND gate and an Exclusive-OR gate. Complete the table of states below. Show that the circuit produces the desired logic function for active high signals. A B S um (S ) = A + B S C arry (C ) = AB C Figure 22 Table of States for Figure 22 Inputs Outputs Sum Carry DIO 0 DIO 1 S C Page 25

Locate the 7483 full adder chip (pinout shown in figure 23). This adder produces a fourbit sum (Σ) and a carry out (CO) from two four-bit words (A and B) and a carry in (CI). (You will need to ground CI and connect CO to DIO 12.) Figure 23: 7483 4-Bit Full Adder The table below describes the binary addition of A = 10 and B = 9 to give a sum = 19. In the pinout, the least significant bit (LSB) of word A is designated A1, the next most significant bit is A2, etc. Word B is designated by B1 B4, and the output is designated by Σ1 Σ4 and CO. MSB LSB CO DIO 3 DIO 2 DIO 1 DIO 0 CI Word A = 10 1 0 1 0 0 DIO 7 DIO 6 DIO 5 DIO 4 Word B = 9 1 0 0 1 0 DIO 12 DIO 11 DIO 10 DIO 9 DIO 8 Sum = 19 1 0 0 1 1 Use logic level output signals from the Digital Writer program to represent word A and word B. Perform the binary addition of four pairs of 4-bit binary numbers and record the results in the table below. The designated function is performed for active high signals only (0=LO, 1=HI). Page 26

Word A Word B Sum Carry A4 A3 A2 A1 B4 B3 B2 B1 Σ4 Σ3 Σ2 Σ1 CO Out Decimal Equivalent Question 21. Sketch a schematic of a circuit that uses 7483s to add two 8-bit words. (Hint: the carry out from the first 7483 should be connected to the carry in of the second 7483.) Question 22. Two nuclear particle counters are used, one to count β particles and the other γ particles. Parallel digital outputs (assume 4-bit for simplicity) are available from each counter. A warning signal is desired when the sum of the β and γ particles exceeds a preset binary number. Sketch a schematic of a circuit to produce the warning signal. Binary decoding - A binary decoder provides a separate logic level output for all combinations of input logic levels. The binary decoder of figure 24 decodes the four possible states of the two bit input, EF, into separate output lines Q, R, S, and T and is therefore called a 2-line to 4-line binary decoder. Wire the circuit of figure 24 using the basic logic chips on the ELVIS II breadboard. Verify the decoder function by entering the two bit combinations listed in the following table. E F Q = EF R = EF S = EF T = EF Figure 24: Decoder Circuit Page 27

Table of States for Figure 28 Inputs Outputs E (DIO 0) F (DIO 1) Q (DIO 8) R (DIO 9) S (DIO 10) T (DIO 11) L L L H H L H H Digital Multiplexers - Digital multiplexers provide a convenient means for selectively routing information from one circuit to another. The circuit of figure 25 allows one of the four signal sources W, X, Y, or Z to be presented at the output according to the choice of signals applied to the control inputs (A, B, C, D). Wire the multiplexer circuit of figure 25 using the integrated circuits located on the Elvis II breadboard, and connect the data inputs to logic level sources (DIO 4 DIO 7). The control inputs (A-D) should also be connected to logic level sources (DIO 0 DIO 3), and the state of the output can be determined using the LINE STATE 8 LED in the Digital Reader program as an indicator (connected to DIO 8). W X Signal Inputs Y M Z Out A B C D Control Inputs: 1 - Closed, 0 - Open Figure 25 Determine the effect of each of the inputs upon the output for each of the control settings shown in the table, and record the results. This is done by entering the control word, and toggling each signal, W, X, Y, Z, individually. You should only see one signal being routed to the output. Page 28

Table of States for Figure 25 Control Words Outputs A B C D M no effect on output L L L L L W, X, Y, Z H L L L W X, Y, Z L H L L L L H L L L L H The control inputs of the multiplexer made from basic gates are cumbersome to use. An elegant MSI implementation of the multiplexer function is found in the 74151 eight-line to one-line data selector/multiplexer chip located on the ELVIS II breadboard. Connect switches A, B, C of the BSI job board to the data select inputs A, B, and C to the 74151 integrated circuit. Wire eight different logic level signals to the data inputs DIO 0- DIO 7 (refer to figure 26). Finally, connect the strobe input of the 74151 to switch D on the BSI job board. Wire outputs Y and W to DIO 8 and DIO 9. Now systematically change the data select lines from LLL to HHH and determine which of the input signals appears at the outputs, Y and W. Figure 26: 74151 Multiplexing Chip Page 29

Data Select LLL LLH LHL LHH HLL HLH HHL HHH Data Bit Multiplexed to Y and W(0-7) Change the strobe signal state and note the effect on one or more of the signals. Question 23. A digital clock is designed with a 1.00 MHz crystal oscillator and 3 decade-dividers providing digital outputs of 1.00 MHz, 100 khz, 10 khz, and 1 khz on 4 separate lines. Design a circuit to multiplex these outputs and allow any of the frequencies to be selected. Use a 74151 in your design. Include a state table for the select bits and indicate which input is routed to the output. Page 30