Welcome back to Electronics. This is Dr. Ferri. In this lesson, we will look at CMOS logic gates. In a previous lesson, we looked at MOSFETs, and, and their use as an electronically controlled switch. In this lesson, we will introduce logic gates, and their transistor circuits. Now, the reason we're doing this is because transistors are the basic device in all of digital circuits, in computers and every other digital circuit. Now, we group these transistors together into specialized circuits that we call logic gates. And then we end up designing on a little bit higher level rather than designing transistors by themselves. We design computers based on logic gates. These which are just circuits made of transistors. So, a NOT, a NAND, a NOR, and an OR are going to be our basic logic gates that we will look at today. I would go back to our last lesson. We looked at the CMOS NOT gate. Actually, we called it an inverter circuit there, but it is the same as what we'll call a NOT gate here. Value inverter, just to summarize it, when the input was high, the output was low, Input was low, the output was high. Now, we want to convert this into binary, because computers work in binary logic, binary zeros and ones. What do we mean by zero? A zero is a low voltage. And a one is a high voltage. So, our input of high and low goes between one and zero. It's a binary value for it. And then instead of talking about voltages, we come up with a binary variable that is, let me redraw this. That, instead of saying voltage input, this now becomes a variable, a variable that can take on a value of zero or one. And my output takes on a value of zero or one. A truth table is simply a representation of the inputs. And the outputs. So, then we've got a circuit symbol for a NOT gate, which is right here. And, this line over it represents NOT. So, the, the way I'll read this is B is equal to NOT A. And, a NOT A just means it inverts it from 0 to 1, 1 to 0. That's our most basic circuit element, most basic logic gate. And I've just redrawn it here to summarize the truth table and the symbol. Let's look at another one. It's an and gate. An and gate has two inputs to it, and again each of these inputs can take a value of zero or one, two inputs and one output. So, our truth table has two inputs and then one output right here. And the and gate is represented by saying both the, both inputs, A and B have to be one in order for the output to be one. So this is read C is equal A and B. And that's, and this again is the circuit symbol, and we often times represent it the boolean algebra expression is, it looks like a times b, but again it's read by a and b. A NAND gate is not an and. Not an and means that I take that I take all my zeros of my and output and I invert them. I not them. So, all these zeros become ones, the one becomes the zero. And then this is a circuit symbol for a NAND gate. Notice all I did is take the, the bar that represents a NOT gate and put it over an and gate. And the other difference is I've got a little circle here. So, this is an and gate but with a little circle on it. My next basic circuit element is an OR gate. And an OR gate I read it by saying, one or the other input is one, then my output is one. So, one or the other or both are one, then my output is one. This is the circuit symbol for an OR gate, and this reads C is equal to A or B, and this is a boolean algebra expression. The last one I want to cover is not an OR a NOR gate. A NOR gate takes my OR gate and inverts it, or NOTs it. So, my zero becomes a one, my ones become zeros. This is a circuit symbol for a NOR gate. It's got the little, it's an OR with a little circle on it. And also, in the algebraic expression, I take my NOT symbol, and I put it over the OR operation. So, those are the five basic symbols. We've already shown the transistor circuit for a NOT gate. Now, I want to show the transistor circuits for a couple others of these. So, in order to be able to build these other logic gate circuits, let's go back and just remind you about the CMOS switch behavior. The NMOS and the PMOS transistors are on the left, so you can recognize their, their symbols here. And this is how they behave. And remembering that our input is now treated in terms of binary. We're looking at the binary version of a high, which is a one, and a low, which is a zero. And that tells us when this switch is on or off. And remember that the PMOS works exact opposite way than the NMOS does. So, this is our NAND gate, a summary of it on the left, the truth table and the circuit diagram, the circuit symbol. And then this is the transistor circuit for it. And I want to just look at a particular case here just to show you that this works. Let's look at a case when A is equal to zero, B is equal to one. So drawing the top part of it,. And then I'm going to draw the bottom part. I'm, I'm drawing this without there, indicating the switch is on or off right now. Okay, and then this is a high voltage here, which we represent as a one in a binary value. So if a is zero, that means that the, this p type switches on, and if b is one, that means this is off. So, in terms of the n type of logic, the if a is equal to zero this switches, is off. And if b is equal to one, this switches on. So, what I have here is a direct connection between my output and high. So, c is equal to one. So, if my, if I have a value of A0, B is one C is going to be equal to one. So, that goes over to this case of 01 is my input and C is my output equal to one. So, that just demonstrates that this works, at least in this case that, I've shown that it works. This circuit implements the NAND logic. Now, let's look at the same thing with the NOR gate. Let me just pick one case. I'll pick the, the a is equal to one, b is equal to zero case. That should be this one right here. And again, I'm just going to kind of draw my switches in here without indicating what they are. If they're open or closed or on or off. And then I'll go back and fill it in. And then this is a one up here. It's high equal to one. All right, so in this case, if a is one this is open, because it's a p type of transistor. If b is zero, this transistor is closed. Now, on the bottom these are n type transistors, so a if, if a is one, this is on, if b is zero, this is off. So, what I have here is a direct connection to ground. So, C is equal to zero. So, in this particular case, when A is one, B is zero, C is zero, and that goes back to this entry in the truth table. Again, this just represents how, demonstrates how, we can build a NOR gate out of transistors. Now, the nice thing about the transistors, the transistor logic gate circuits is that I can cascade them. So, I can make the output connected to the input of another gate. So, in this particular case, I've got an, a NAND gate connected to a NOT gate. And what I've done, is I've knotted a NAND gate. In other words, I've created an AND gate. I've double knotted something. And that removes the, the double knot. And so, this becomes c is equal to a and b. So, I can get more elaborate with it, and I can build all kind of boolean algebraic expressions by just symbolically drawing my schematic this way, the output of one gate becomes the input of another gate. And you now know what this means in, in terms of the, the circuits. I'm, the output voltage of one becomes the input voltage of another. They're connected together. Now, out of gates like this, I can build circuits that add numbers, binary numbers multiply numbers, subtract numbers, do a lot of different things. And that's why the logic gates are the basic building blocks of computers. And then we've shown how you, these logic gates are actually built out of transistor circuits. So, in summary, logic gates are made from CMOS n-type and p-type transistors. And remember we put them both in there because neither one on their own is a, is a very good switch, but together they perform close to ideal behavior. In our next lesson we start to look at amplifiers made out of moss fets. So, I hope to see you online, and please go to the forums to ask and answer questions. Thank you.