# Logic Gates - Logic States

## Digital

Logic Gates - Logic States

Video Lectures created by Tim Feiegenbaum at North Seattle Community College.

We're looking at Logic States and we're completing Section 15-1. Digital devices operate on binary values so there are only two allowable digital states. Each of these states is called a Logic State. A variety of names is used to label these two states. Typically, we're looking at zeroes and ones and a Logical 1 often is indicated by true, high, yes, on – a logical 0 as false, low, no or off. In the context of digital circuits, these are terms that are commonly used to reflect either a zero or a one.

Sometimes the logic state is indicated by the presence or absence of a voltage or different polarities of the same voltage. By far the most common is by the presence or absence of a voltage, typically a low is zero and a high would be +5 volts, so there is a trend towards lower voltages.

Sometimes in computer systems, you'll see a low is zero and sometimes a high can be as low and possibly 2.3 volts. At any rate, the low is indicated by typically zero and the high by a little higher voltage.

### Truth Tables

Truth tables provide a way to describe the relationship between the inputs and outputs of a logic device. Below here has depicted a “Truth Table.” Here we have a logic device. In this case, we have two inputs and we have an output. Since our outputs or inputs can only be zeroes and ones, there is a limit to how many possible varieties of inputs we can have.

What a truth table does is it indicates all of the possible inputs that we could get from these two inputs. Since this is binary and we have two inputs, we'll have two-square, this is the number of possibilities that we'll have for inputs - so we have 0, 1, 2 and 3. Those indicate our four possible inputs and typically A is considered to be the least significant variable in a Truth Table. There we have A and then again, four possible inputs. If we'd added a third here then we would have two to the third, where it would have eight possible input values.

Then here in the Y, we see what is the results and outputs. Again, this is a truth table and it shows us all of the possible inputs and outputs for a given logic circuit.

### Timing Diagrams

Timing diagrams also show relationships between input and output conditions in a logic circuit. Here we have our logic circuit. Here we have three possible inputs and two possible outputs. Here we're showing ... and this is typically what you would see in an oscilloscope. It's reflecting the highs and lows and these were the inputs and then these are the resulting outputs. We're not going to analyze this at this time but this is typical of what you would see concerning inputs and outputs into a digital logic circuit.

### Boolean Algebra and Logic Gates

Boolean algebra provides a means to describe and understand the behavior of logic circuits. Boolean algebra describes the relationship between input variables and output variables. Logic diagrams also provide a way of representing a logic circuit. It is critical to understand Boolean algebra and logic diagrams in today's electronic environment.

### Logical Operators

Boolean algebra will utilize Logical Operators. Only a few logical operators exist to describe logic relationships. These fundamentals operators are: NOT, AND, OR and exclusive OR. We're going to be looking at these operators on the slides that follow and we'll be looking at the Boolean expressions for these operators.

### "AND" Operator

The first one we're going to look at is the “AND” operator. The Boolean expression for a two-input AND gate is Y=AB, and it is read as “Y equals A and B.” If you could look at that, it is effectively A times B.

As shown, the output Y is high only when A and B are high, so this is the representation for AND. You have a flat here ... flat surface and then you have the two inputs coming in and you have an output. Here is the associated truth table with two inputs. We're going to have two 4 possible inputs so that it would be 000110 and 1 and 1. What you'll note is the only time that you have a high out of this is when both the inputs are high. Then you will have a high out.

Electrically you could view this like this that the only time that you'll have the illumination of this lamp here represented by Y, is when both switches are closed. so this is the AND gate.

### "OR" Operator

The next basic gate is the “OR” gate. The Boolean expression for a two-input OR gate is Y = A+B and it is read “Y equals A or B.” As shown the output Y is high if either or both A or B are high.

The expression here is ... and you have a curved front and you have the A. This would be the two inputs and this would be your output. Remember the AND look like this. This would just associate it from an OR.

Again, here is our Truth Table and recall that you're going to have a true or you're going to have a high out if either A or B is high. In this case, the only time you will not have an output is when both A and B are zero. The Truth Table looks like this. If I have one good input then I will have a high out. This would be the associated circuit if either of these switches is closed, then I will have illumination in Y and if both are closed I'll still have illumination in Y, so there is an OR operator.

### "NOT" Operator

The next one is the “NOT” operator. The logic expression and Boolean expression for a NOT operator is Y =, and you see that line over the A means not A. It is read “Y equals NOT A.” The line above A is called a vinculum and indicates the NOT complement function. The NOT operator is also referred to as an inverter and this is the logic diagram. You have the amplifier symbol and then the zero here which is the NOT operation.

Here is the Truth Table: if A is zero, Y is one, if A is one, Y is zero. If you recall from transistor theory an inverter can be implemented with a transistor and in this case if we had a high coming in.  The high would come in, it would turn on the transistor, the transistor would saturate and it would look like a close ... which typically you have about 0.1 volts between the emitter and the collector. For this purpose that would be effectively zero, so that would be the high in and you'd get the low out.

Now, if we came in with a low which is effectively a zero, the emitter-base junction would not be turned on. The transistor would effectively be off and the 5 volts here would be felt on the collector, so here you have a low in but effectively you would have the 5 volts reflecting a high out. This is the NOT operator.

### "NAND" Operator

Next is the “NAND” operator. A NAND gate is very widely used in logic function. It is a combination of an AND gate and an inverter. Here you have the AND gate and then the little zero here is the inverter. The small circle at the output indicates the inversion operation.

Now this will give us an output that is exactly the opposite. If we had our AND gate it would be exactly the opposite of an AND gate, because whatever you get out at the AND gate it is NOT. In this case if I have a zero and zero coming in it's going to be a zero out but now it's inverted, so it's a one. A zero and a one should give a zero out but since it's not, already it's a one.

The only time that I'll get a zero out is if I have a one and a one which would give us a one out of the AND but then it's not, so it becomes zero. This would be one way to implement this. Again, if we have a one and a one that would give us a voltage here but it would be inversed, so that would give us a zero.

### "NOR" Operation

Next is the “NOR” operation. The NOR operation is another very common logic function. It is a combination of an OR operator and an inverter (NOT).  Remember again, we had the OR function and it would give an output if either A or B was high but now since its naughted, then it's going to be just the opposite. If either A or B is high, then we're going to get a zero and this is just the opposite of the OR operation. The only time it will get a high out here is if we have a zero and zero - then we will get a high. A way of implementing that would be this circuit right here where we'll get a valid input if either A or B is high but then it is going to be inverted, so that would reflect this Truth Table.

### "Exclusive OR" Operator

Then we have the “Exclusive OR” operator. The Exclusive OR operation performs the logic function that Y will be TRUE if EITHER A or B but NOT BOTH are true.  This is what we called exclusively OR, meaning that you have to have one or the other but not both. You'll see here the only time that you have a valid output - one is when both A and B are different. A zero and one gives us an output, a one and a zero give us an output but if it's a one and a one or a zero and a zero there is no output. You see electrically you could implement this like this where here we have a zero and a one which illuminates the light or a zero and a one here which illuminates the light but if these are switched for zero and zero or one and one, then there will not be a complete circuit.

This has introduced our basic Logic Gates. So we look at exclusive OR, we look at NOR, NAND, NOT, OR, AND. We mentioned Boolean algebra and we will spend the next section ... We're going to talk about Boolean algebra quite a bit more. We looked at the concept of Timing Diagrams and

Truth Tables, so this concludes section 15-1.

Video Lectures created by Tim Fiegenbaum at North Seattle Community College. 