YTread Logo
YTread Logo

An Introduction to Logic Gates

May 31, 2021
Hello, today we are going to do an

introduction

to

logic

gates

. This will be a very simple

introduction

and again, please ignore all the pencil lines you can see, which will simply be a guide for me when I hand over the video. To understand

logic

gates

we really need to understand how transistors work and that was covered in my video Atomic Physics 3 Semiconductors, Diodes and Transistors and there is a link to that video on the screen but you may remember that I showed that there is a device called npn device which is made of semiconductor material this is n this is p this is n and the point about this type of device is that if you apply a voltage across that device plus minus then you can expect electrons to flow towards the positive positive charge , but they actually don't because there is what's called a depletion layer that builds up at this junction that I describe in the video above that essentially stops the flow of electrons, but if you put a positive charge on that point, then the electrons actually flow through and so this is essentially a switch if there is no positive charge at that point no electrons flow in other words no current flows but if you put a positive voltage at this point then electrons will flow and a current will flow, so which is a very simple transistor switch, we call this part the emitter transistor because it is where the electrons are essentially emitted from.
an introduction to logic gates
We call this part the collector because it collects the electrons if you want and we call this part the base, it is sometimes called the gate. Now in electronic circuits you will find that a transistor is usually represented by a symbol of this type of shape and in this case this is the emitter, this is the collector and this is the base, so this is just a schematic representation of this Mater semiconductor material here. and the same principle applies that if there is a voltage that you can have, it varies for different transistors, but let's say you have 5 volts here and N volts here, then we better put the wires together so that there is a link and the position is that . no current will flow, the electrons go in this direction from the emitter to the collector, so conventional current comes in this direction lowering the voltage, so no current will flow through that transistor if there is no voltage at the base, but if you put a voltage on the base, then a current will flow through the transistor, so what you can say is that if there is no voltage on the base, then the switch is off because no current will flow, to the extent that that transistor act as a switch, it is turned off nothing will flow and that is often given the zero symbol or sometimes called false, on the other hand if there is a positive voltage at the base then the switch is on and it is given the representation one or true all these schematic diagrams of transistors that The drawing in this video will be like this with the emitter here, the collector here and the base here now, since we are looking at logic gates that are based on transistors, we must temporarily abandon transistors to understand a little bit what logic we are talking about and this is known as Boolean logic or Boolean algebra and I can try to describe it by imagining that there is a playground and there are children playing on the playground and some of those children are wearing jackets red and some of the kids are wearing black shoes, this group of kids are wearing red jackets, this group of kids are wearing black shoes and this group in the middle is wearing red jackets and black shoes, so if I shade the area, what you get is that this shaded area are children who wear red jackets and black shoes this group are children who wear red jackets but not black shoes this group are children who wear black shoes but not red jackets and everywhere there are children who do not wear red jackets or shoes blacks here is the same playground again and here are the same groups, but this time I want to know who are the children who wear black shoes or red jackets or both, then the answer will be everyone inside the two circles because they wear red jackets or they wear black shoes or they wear both and the last question that could occur to me, just for these illustrative purposes, is how many children do not wear red jackets or black shoes and the answer is everyone who is outside the circle and in terms of logic. this is known as and because what we are saying is red jackets and black shoes, this is known as or in other words, you are wearing red jackets or you are wearing black shoes or maybe you are wearing both and this is known as no, i.e. , you are not wearing a red jacket or black shoes or both.
an introduction to logic gates

More Interesting Facts About,

an introduction to logic gates...

Now, what logic gates do is translate that Boolean logic into an electronic form. Later in the video I will explain exactly how these gates are built using transistors, but let's think about the different types of logic gates you can have and there are seven basic logic gates, the first one gives effect to this logic and the logic is actually called a gate. and its schematic form is something like this, it has two inputs and one output and that is called a gate and and what it means is that you have two wires going into a device, in fact we will design the device in a moment and one output of the device here are some electronic components that I have I haven't told you, but the idea is that if both inputs have positive voltages then there will be a positive voltage, but if one or both have no voltage then there will be no voltage, in other words you will only get one voltage positive.
an introduction to logic gates
There is no voltage if both inputs have positive voltages, if one or both do not you will get no voltage, so it is a part of the logic that tells you that if you get a positive voltage it must be because they both have positive voltages the following electronic device gives effect to the o option and that is called an o logic gate and the diagram for an o gate looks like this again, it has two inputs and one output and now the idea is that you will get a positive voltage output if one or both inputs have a voltage positive, then if none of them have a positive voltage you will not get output, but if only one of these has a positive voltage or both then you will get a positive voltage, the following device gives effect. to the fix not here and again, this is an electronic device called a KN gate and its symbol looks like this, it only has one input and one output and the idea is that whatever the input is, the output is the opposite, so which if the input has a positive voltage the output will have no voltage if the input has no voltage the output will have a positive voltage whatever it is it is the opposite of this and is often called an inverter for that reason now there are four more quite common doors, the next one is called the north door and it is drawn more like a door or here is the door or so far it looks the same, but what you do is put a small circle there and that tells you that it is a no , it's not so it's a nor version of the o gate and what this means is that you only get a positive output if they both have no voltage on the input, so if there's no voltage here and there's no voltage here, you get a positive voltage , but if either or both are a positive voltage, you get nothing here, the next logic gate is called the x gate or and it has a symbol that looks like this, pretty similar to the o gate, except it has this extra line here and it also has two entrances. an output and what an and one of them is zero, so it could be positive, it could be zero or it could be positive and it could be zero, so you get an output and then there's the opposite type of that, xn, which looks exactly the same as x or except that it has a little circle so it has two inputs one output and this is the opposite of this in other words this will only give you a positive output if both inputs are positive voltages or both inputs are zero voltages you will get a voltage positive, but if one of them is positive and one of them is zero, you will get nothing and that is precisely the opposite of this and then the last one in the basic series of seven is It's called a nand gate, which in a way says no and its symbol It is very similar to the and symbol.
an introduction to logic gates
It has two inputs, but because this is the an symbol because it's a nan symbol, of course, it will have a little circle to indicate and what that will do. What you need to do is it's going to give you a positive output if either or neither of them have a zero um voltage, it's going to give you a zero output if they're both positive voltages, but if one is a positive voltage and the other is zero or both are zero. so you're going to get a voltage uh and in that sense of course it's precisely the opposite of gate and gate and you only get a positive voltage if you have two positive voltages coming in, in this case you don't get voltage if you have two positive voltages coming in but if you have one or both as zero voltages, you will get a positive voltage now.
I'm just going to give you an illustration of how you can use these devices to build a very, very, very simple computer. Suppose we want a computer that allows us to solve the equation a + b = c and here we are going to be very simple because the only values ​​we can have for A and B will be zero 0 or one, then A and B can be Z or 1, which means that the value of C can be zero if a and b are both zero or the value of C can be one if a is 1 and B is zero or vice versa or the value of C could be two if A and B are one, then if we put that in a simple table where we put the values ​​of a b and C, then we say that if a and b are both zero, then C will be zero if a is 1 and B is zero then C will be 1 if a is zero and B is 1 C will be 1 and if a and b are both one c will be two and we are going to build a computer that will do that calculation for us and We are going to use logic gates to do it, so here's the device that we're going to build, we're going to have an , we are going to have two inputs and they are going to represent our values ​​of A and B and if there is a positive voltage then that represents the number one and if there is no voltage then that represents the number zero, in other words we are going to put a positive voltage on a or not and a positive voltage on b or not and the positive voltage represents our number one and If we don't put a positive voltage, that represents the number zero, so now we will pass these wires to all of our logic gates, we will also pass the B to all logic gates, so now we have a and b powering each of our three logic gates, they will all have outputs and what I'm going to do is send those outputs to a light emitting diode.
These are diodes that will light red or any other. color actually, but red is common if there is voltage coming down the line, but they won't glow if there isn't now. What does an exor device do? Let me remind you that it will send a positive voltage if one of these are positive and the other is not, if neither of them have voltage or if they both have positive voltage, you will not get output, but if one of them has a positive voltage and the other does not, you will get a positive voltage. The voltage is cut off and the light emitting diode will light up brightly if one of them is positive and the other is not.
You basically have 1+ 0, so this is essentially the answer. What about the door and? Well, and it will only go out. a positive voltage if I missed an input there if both inputs are positive okay that means A and B have to be positive voltages so a has to be one and B has to be one so this It is essentially the answer to two. If this lights up, it must mean that there is a positive voltage at A and a positive voltage at B and what about neither will it only send a positive voltage if both inputs are zero volts if one or both have positive voltages?
You will get no output so the only way this light emitting diode will turn on is if both inputs have no volts and that means they represent zero so 0 + 0 is zero so what you need to do is take your inputs A and B and Put whatever you want, you can put, say, a positive charge on A and no charge on B and what will happen is that you will not get any result and because they both have to be postponed, they both have to be positive and there will be no output of the nor because they would both have to be zero, so these two transistor light emitting diodes will not light up, but the x or will light up because the xor says one, but not both have to be positive and when it turns on , you've added one and zero to make one, that's a very complicated way of adding two numbers that can be zero or one, but that's what the heart of computers does, except they have millions of these logical devices that handle information very quickly, so now let's see how we could design these logic gates using the transistors and we will start with the not gate and what we mean when we talk about the not gate is that the output that we normally refer to as Y is equal to not the input and if the input is labeled by a then it is generically said a with a bar over it means no, then the output is not the input, that's what we mean and we're going to start with a transistor with a base input. and we're going to go up through a resistor to a 5 volt battery and at this end we're going to go down to 0 volts, which meansessentially that is connected to ground, so this is Zer volts and we have an output that we will use here.
We could say it's a light emitting diode, so that diode only turns on if a positive voltage comes out of the output um. Now what will happen? Suppose there is no voltage at the base, if there is no voltage at the base, this switch will be open, in other words, no current can flow through the transistor because there is no voltage at the base and that means there will be a positive voltage. at this output because it's at 5 volts, some of that will drop across the resistor but there will still be a positive voltage, we don't need to worry about what it is, there will still be a positive voltage here and that means the transistor will light up, so If no voltage comes in, voltage will come out.
Now let's look at it another way. Suppose voltage comes in. If voltage comes in, then this switch closes and a current can now flow. the transistor and if a current flows through the transistor, since this point is 0 volts, this point will also be 0 volts, so now you have a positive voltage at the base of the input, but now there is no voltage across the exit because there is a current. flowing through here and essentially this and this have the same potential and that potential is zero so this potential is zero and the full 5 volts drop across the resistor here so this is simply an inverter and what you can do is draw what is sometimes called a truth table, if you look at the input which we will call A and the output which we will call Y, if the input is 0 volts you will get a positive voltage which we denote by the number one in the On the other hand, if you have voltage at the input you will not get voltage at the output so this is an inverter.
Whatever you put in the input you will get the opposite in the output and this is essentially known as a truth table and I will draw more of these for other devices the actual symbol for the door is not the triangle with the little circle on the end and when you draw a triangle with a little circle on the end, this bit in the middle is the transistor and the resistor is essentially the component that is creating the gate uh not and here is the input here and here is the output here single input single output Of course you have to power it and that's what this 5V is probably doing here a battery of some kind but that's just the power this is the input this is the output now let's go ahead and design a gate and then this is a gate and and that is usually written as and is a do B that is the standard way of defining the output is a and b together and once again we have our transistors, this time we are going to have two transistors and they are connected together, this one goes up to the 5V battery, this pulls down through a resistor to 0 volts, so it is essentially connected to ground, it is best to connect it. here and our two inputs are essentially the two base inputs of the two transistors and we're going to take the output at this point here that's our output and once again you can send it through a light emitting diode if you want.
We're not going to draw that here, what we're going to look at now is the logic: if you don't have volts on these two inputs, then these two transistors that act as switches will be open, so no current will flow through the transistors. and consequently, since this point here is at 0 volts, then everything up to here will be Z volts, this is essentially a switch that is open, no, no current can flow this way, so all of this will be at 0 volts , so the output is zero, then if both inputs are zero, the output is zero, what happens if one of them is open?
Sorry, one of them has a positive voltage and the other has zero volts. If it has a positive voltage, a current can flow through that transistor. but if that is Zer volts, it is of no use because current cannot flow through this transistor and vice versa, if it has one volt, current could flow through this transistor, but if it has zero volts, it cannot flow through through this. one even if you have one of them with positive charge and the other with zero charge, sorry one voltage positive and the other with zero voltage still can't flow current therefore this will be at 0 volts but what happens Yes, both? have positive voltages, then the switches will close, a current can now flow, the potential difference will drop across the resistor, but this output will now have a positive voltage because it is connected to the 5 volts up here across the switches that now they're closed, so if and only if both inputs are positive, you get a positive output and that's the door and and the door symbol and it's something that looks a little bit like this, so when we draw the door and like this So what we're really saying is here are the two inputs, here's the output and these two transistors and the resistor are what's in it, so once again we can draw our truth table for our inputs and our output, our inputs are A and B and our output and, if the inputs are both. zero the output to zero if one of them has a positive voltage and the other does not the output is still zero if its the other way around the output is still zero only if A and B have positive voltages will you get a positive voltage let's move on and let's design the o gate and this is often represented as Y, which is the output equal to a + b and of course that means that either or both are true, whether it's inputs A or B, um it's going to be a positive voltage and once more I need two transistors with the two inputs here A and B, these are the two inputs, this time we are going to connect this to the 5V battery and here we are going to connect it through an n volt resistor, but what we do here is We send this to the 5 volumes that way and here we take it to an output that comes here.
Now let's draw our truth table as we go through the inputs A and B, the output is y. Now let's ask what happens if and b are both zero, if a and b are both zero then these two transistors which act as switches are open which means no current can flow this way and no current can flow this way in other words , this output line here will be at exactly the same voltage as here and that is not volts, so if a and b are not, no current can flow through that transistor, no current can flow through that transistor, so Therefore, the exit is not now either.
What happens if a is one? In other words, if a has a positive voltage but B is not doing well, let's first do B, B, no current flows, so nothing happens as far as B is concerned, but if a has a positive voltage here, A current flows through the transistor and down. at zero volts I'll just show you the way back through that transistor which is now closed, the switch is closed because there's a positive voltage here, so across the transistor to the ground here and that means there's going to be a potential drop to through the resistor, but there will be a positive voltage at the output, so there is a positive voltage there and I think you can see pretty easily that the same is true if it's the other way around, if it now has no voltage, there will be no current. that way, but if B has a positive voltage, then current can flow through the transistor and down here the potential drops across this resistor, which means that the output here has a positive voltage and obviously if A and B have positive voltages so the current can flow this way and this way and that means there will be a positive voltage at the output so now we have a device that says if you have no voltage at the input you won't you will get voltage at the output but if you have a voltage at one or both inputs you will get a voltage at the output and the symbol we use for an orgate is the one I drew before and that is this one now in fact we can use this description of the orgate to create our Norgate because you don't do much else with a Norgate with a Norgate you just add an extra transistor and you have the output of the orgate going to this transistor and then you pull up a resistor to the 5V level and you pull down here to the nvt level and this of course is simply a knot gate which is EX exactly what we draw here transistor and a resistor is a knot gate so this is not a gate in other words whatever sorry we'll take the output there, whatever the output of the door or the output of the door will not be the opposite, so now let's look at our truth table and we can see that this is the output of a door or but now let's look at the output of a door nor, it's always going to be the opposite of whatever the gate is putting out because we're passing it through an inverter, so if it was zero here, it's going to be one here if it were one. here it will be zero if it is one here it will be zero if it is one here it will be zero it is precisely the opposite of the orgata because we are passing it through an inverter and taking the output here and that output will be the opposite of the input and the input is effectively the output of the gate or, so now you have a Norgate and a Norgate symbol, of course, it's the same as an orgate, but you put a circle on it like this and the representation of a Norgate is y = a + b, which is the same, of course, as the orgate, but you put a line at the top.
Remember that one line at the top, the same way we did with the knot door, one line at the top. above I said it means there is a KN element, so here we have a non-mineral, this is the orgate, this is not an orgate, it is the opposite of an orgate, giving us exactly the opposite output to what you would get from an orgate and now we are going to see a nand gate which is the one that remembers that it is not and then and the output is equal to a dob which is the same as for the and gate but since it is a knot, you put a line over the top and the way in which we designed that again we need two transistors and each of them will have an input and those will be our inputs A and B, we are going to go up through a resistor here to the 5V level and we are We are going to connect these two here to an nvt level, so essentially once again we place a battery between the two devices and right now we're going to take our output along this line here and now we're going to draw our truth table as we go by A and B are our two inputs and Y is our output, so let's assume both outputs are Z volts, if that's the case the switch is off, that switch is off, no current can flow through here and consequently the current will flow this way some of the voltage will drop through this resistor but there will still be a positive voltage here because no current can drop here so there is a positive voltage so if there is no voltage at the inputs there will be a voltage at the output what happens if A is zero but B is a positive voltage?
Well the current still can't go down because it can go through, it can't even go through the transistor to uh let alone go through B1 and consequently there is no current flowing downwards, the current will flow this way, there will be a voltage drop through the resistor, but there will still be voltage here and similarly the other way around, if a and b a have the positive voltage, B does not have it, then current will flow through transistor a but it cannot pass through transistor B because that transistor as switch is open consequently the current can go this way, some voltage drop across the resistor but there is still a positive voltage here but if both A and B have positive vol voltages both switches will close the current will now flow directly down here all the voltage will drop across that resistance which means that this point here will have the same potential as this point here because this is just the equivalent of a In the straight wire, the current flows directly, so this potential, which is 0 volts, is the same as this potential and therefore the output will be 0 volts, it is an n and what it means is that you get an output for everything except where both inputs have We have positive voltages and remember the gate symbol ay is the same as the gate symbol and except it's a no, so a little circle is formed and then the output we've made five of the gates, we just have two more. to make the next one we're going to make is the door inputs is positive but the other is not so one can be positive but not both and here we have to use other gates which will contain transistors but actually we need to use four nand gates to create an X or gate and that is how you start to see how these Gates are constructed in logical terms, so let me draw my four Nand Gates 1 2 3 4 and we are going to connect them like this here is the input, well actually the input will come here and we are going to split the input of This way the output coming from this nand gate becomes the input for this nand or these nand gates and then the output of those nand gates becomes the input for this nand gate so here is the input this is a and this is B, we split it to send the input through this nand gate, we also take a and b into these nand gates and take the output of the gatenand into these nand gates and then we take the output of both. nand gates to become the input to this nand gate and finally we get an output from there so let's try to create the truth table.
We have A and B and we have Y, which is the output, and let's start with A and B is zero and remember the point about a nand gate is that you get an output under all circumstances unless both inputs are positive, so that we have Zer here, two zeros that will give us a positive output, so now we will have a positive output here with a zero coming in here, a one and a zero still gives it a positive output, similarly, remember we had a positive output with a negative still giving a positive output, now we have a positive going in here, a positive going in here and two positives going through an nand gate will give you a zero output.
I hope you followed that. Now let's make the situation where a is zero but B has a positive result. uh enter so a is positive sorry a is zero but B is positive so in this one we have a zero and a positive well that means you're going to get a positive result a positive result that's going to go in here along with a zero. you're positive, so that's positive coming in here, what's up with this end? Well, we said, remember it's positive, so B is positive, the output here is positive, so now we have two positives coming in, that means you're going to come in. to get a Nega you will get a zero coming out, you had a positive coming in here a zero coming in here a positive and a zero will give you a positive output if you do it the other way around, I don't think it needs to be explained, it's obviously symmetrical, it will be exactly the same, so there's going to be a positive output here and the final set of situations is if both A and B have positive um inputs, well, what's going to happen?
If it happens, two positive inputs coming in here will give you a zero output because that's the consequence of a nand gate, one positive output input and one zero input will give you a positive output. The same applies here. The positive Z output becomes Z in plus the positive input. gives you a positive output, a positive input and a positive input gives you a zero output, so zero comes out and that is your X or gate, you get a positive output if one or the other is positive, but not both or neither and the diagram. that reflects the X or gate is this and that leaves us with just one more thing to do, which is the a knot and how we create that.
Actually, I don't have to draw another diagram. You will be pleased to know that all you have to do is take the exit here and pass it through a knot gate and if you pass it through a knot gate all that will happen is that the exit from the xor gate will be, so to speak , inverted, so whatever you get from an exor gate is going to be the opposite of what you get from an X Norgate, so down here this is the x or the output is the which you get from here, so it will be 1 0 0 1 and the symbol for a gate a positive output if both inputs are zero or both inputs are positive, but if one is positive and the other is not, you won't get any output of xn. gate now just to say that of course for some of those gates you didn't actually need to use transistors, you could have used diodes.
This is a perfectly respectable door. You pass your inputs through two diodes and join them together here. Here is the entrance. here is the input B and here is the output and if a is 0 and B is zero, the output y will be zero, but if a is positive and b is z, then a current will flow through here and you will get an output if a is zero and B is positive, you'll get a current flowing through here and Y will be positive and if they're both positive voltages, currents will flow and Y will be positive and that's essentially an o gate but that works for o that's fine, but you can't use both. for some of the other gates that we have described, you have to use transistors and finally, just to give you an idea of ​​how these logic gates are used in computers, they no longer use separate individual transistors, but rather they use a process.
It's called photolithography, which is essentially a means of etching semiconductor material to create not just a transistor but what's called an integrated circuit, and currently you can get something on the order of the equivalent of 9 million transistors per square millimeter of an integrated circuit. circuit board a scientist named Moore established what became known as Mo's law in 1965 he said that the number of transistors that could be obtained on a reasonably sized chip would double every 2 years in 1971 about 2000 transistors could be obtained on a chip Using this IC board process now or in 2011, 2.8 billion transistors per chip are possible and those chips will be used to make microprocessors, and microprocessors are what is at the heart of computers and everything evolves at starting from the essence of the logic gates that I described today

If you have any copyright issue, please Contact