Part 1 of a digital logic desing tutorial series. An introduction to digital logic, digital vs analog, logic gates, logical operators, truth tables, timing diagrams, and the dreaded boolean algebra.
Forum: http://www.eevblog.com/forum/blog/eevblog-981-introduction-to-digital-logic/'>http://www.eevblog.com/forum/blog/eevblog-981-introduction-to-digital-logic/
EEVblog Main Web Site: http://www.eevblog.com
The 2nd EEVblog Channel: http://www.youtube.com/EEVblog2
Support the EEVblog through Patreon!
http://www.patreon.com/eevblog
EEVblog Amazon Store (Dave gets a cut):
http://astore.amazon.com/eevblogstore-20
T-Shirts: http://teespring.com/stores/eevblog
๐ Likecoin โ Coins for Likes: https://likecoin.pro/ @eevblog/dil9/hcq3
Forum: http://www.eevblog.com/forum/blog/eevblog-981-introduction-to-digital-logic/'>http://www.eevblog.com/forum/blog/eevblog-981-introduction-to-digital-logic/
EEVblog Main Web Site: http://www.eevblog.com
The 2nd EEVblog Channel: http://www.youtube.com/EEVblog2
Support the EEVblog through Patreon!
http://www.patreon.com/eevblog
EEVblog Amazon Store (Dave gets a cut):
http://astore.amazon.com/eevblogstore-20
T-Shirts: http://teespring.com/stores/eevblog
๐ Likecoin โ Coins for Likes: https://likecoin.pro/ @eevblog/dil9/hcq3
Hi I thought I'd try something a bit different today. Check this out. The reason you're looking at a blank white screen with a cursor is because I've got myself a new Wacom Intuos tablet and I'm rather taken by this thing that's one of these pen based are tablets that allows me to draw and like artists, use these things you know, doing graphic art and digital. you know, animation and all that sort of stuff.
You can use them as simple drawing tablets like this. So I thought I'd try and do some tutorial type videos using this capture tablet and I want your feedback on this whether or not you actually like this format or not because I can do some you know, funky stuff with it I can instantly change colors and it's like I can leave a go light or dark like that and I can change my styles of pens I can instantly push a button and whoop if I push the right button any raised stuff and I can do lots of much more fancier arty stuff like this, but it's just really nice to be able to, just, you know, do a drawing based tutorial just like my regular. Dave CAD stuff that you no doubt familiar with. so I thought we'd give it a go.
so I'd really like your opinion on whether or not you think this is a good idea and I'll probably put a poll somewhere up here in the corner. it should automatically pop up, whether or not you'd like to see more of this style of tutorial, and whether or not you'd actually like to see this on a second channel. like move this sort of screen capture type tutorial content to its own dedicated channel Web That's all I uploaded to. So let me know if you think that's a good idea or not, and let me know what name you'd like to.
If you like that idea, what name you'd like to call at our second channel, it could be like Evie learn or Evie tutorial or Evie University or something like that. Um, please let me know. Um, yes, um YouTube poll single, pop up and work. Anyway, let's get to it.
So what is digital logic and how does it differentiate from the analog world? Well, you might be familiar with a sine wave for example, and that has you know: zero volts here and one volt here and - 1 volt here for example. And this is a representation of an analog signal Anton can vary anywhere you know, within that range, for example, but you might be familiar that a digital system is represented like this. It only has two particular levels like this, and these can be called logic 1 and logic 0. They could be called 5 volts and 0 volts.
It could be 3.3 volts and 0 volts might be our common voltages. For example, there's other ones. It just represents a binary representation of analog voltages. So digital is still analog in terms of the actual waveform, but the way it's interpreted and represented, it's only in binary form like this and it could be called 1 or 0 also called true/false for example.
And you know any name you want to give it, it doesn't matter. It represents 2 different logic states. and because digital still lives in the analog world, then we have to actually set boundaries. If this is 0 volts here, and this is 5 volts here. for example, our waveform is not going to be absolutely perfect. so it's You Know it might be like this, but it might not. Ok 0 and 5 volts. So we have to actually set boundaries in here where something is determined to be a logic 1 and a logic 0.
So in this particular case, like it might be safe. 4 volts just as an example, and anything above 4 volts. So anything in here is determined to be a logic 1. and likewise, anything in here is determined to be a logic 1 and anything under here like this is determined to be a logic 0.
So these levels can be called 1 and 0. True and false. High and low. where 5 volts and 0 volts whatever you want to call it.
But when if the signal is inside this region here, then it's an undefined state. Digital doesn't know what to do with it. Systems don't know what to do with it. So if you've got a slow change in signal like this that ramps up from 0 to 1 volt like this, then this time period.
All this period in here is unknown. so your digital system is not going to know how to interpret that. so that is why you always see digital signals being just 1 or 0 with as fast an edge as humanly possible. So in a typical digital logic system, we might have a chip here.
for example that is connected to ground and is connected to 5 volts or 3.3 volts for example are very typical modern digital logic levels. or even lower, you know, 1.8 1.2 volts. It doesn't matter, it's going to represent a binary value 1 and 0, true and false, high and low and you will have various inputs to the chip and you'll have various outputs to the chip. and these are all going to be is a 1 or 0 or 1 or 0 ie.
in case of a 5 volt rail chip. you'd have 5 volts here and you'd have 0 volts here and it's expecting 5 volts on the input and 0 volts on the input here. with those margins that we are talked about before. So what we need to do is actually look at our basic digital gates.
These chips are all going to contain digital logic or what's called digital logic gates. and there's only a handful of different types of gates which can be used to make up all any chip. Be it your latest Intel microprocessor, that's got. you know, a hundred million gates in the thing.
or they talk. in terms of transistors, you can think of transistors as gates because they're going to turn off and on, but we won't go into detail there. So let's take a look at your basic logic gates. Now, there are three types of basic gates that you're going to need to know.
For starters, the end gate, the Or gate, and the not gate more commonly referred to as an inverter or an inverter gate. So let's take a look at the traditional symbols for these. There are two different types of symbols, which makes it a bit confusing. You should know a both of them. Now they're both defined by I, Triple, E, and IAC and that sort of stuff. but I'm just going to call these the you know traditional style one. So the traditional style and gate is lying like that. with a curved line like that, You can think of it as a D.
Just remember the D and make like that so you've got one output and you've got at least two inputs. As we'll see a logic, an end gate needs at least two inputs. You can have more, but that's a special case. now.
the or gate is actually shaped like this. curved there and then like that's not very good is it? So we'll just draw that one a bit nicer. Once again, two inputs at one output. Now the Not gate is different in that it only has one input and one output and it's got this circle on the end here.
and this is the circle is known as a knot symbol. So the inverter symbol if you just want to draw its on its own is the triangle plus a little knot there. Now, this knot can actually be used on its own, and you've probably seen these on data sheets, the chips, and things like that. the actual symbol on the you know right on the pin.
it might have this little knot on it. It's called this little circle and that implies what that particular pin is inverted. But you also need to know the IEC symbols I'll call them and they're all boring square boxes like this. and we can put our two inputs in our one output and it's got an end symbol in the middle like that.
It's actually reasonably descriptive, so from that point of view, I don't mind it at all. and I occasionally use those myself and the all one. once again, our square, but it's got greater than or equal to one and you'll see why in a minute. So again, I've never really liked that bit and now naught is once again a square, but it's got one and then our one input one output.
but instead of putting the circle, they define it as a little 45 degree diagonal line like that. So that just implies the knot function, and you might have seen that in some Mud - Eat chips as well. Now, it's actually called digital logic for a reason, because these gates and or and the inverter perform logical functions, which we can use to perform computations. That's how computers and everything else are.
You know, Modern digital. Almost practically everything in modern society works using digital logic. Now we can use what's called a truth table here, and you have to know these. You should remember them off by heart and learn how each particular function works.
Now we've got two inputs here I've labeled them a and B and the output C here. So you just draw a table like this with our inputs and now on one side and our output on the other side, and you basically fill it out with all of the possible combinations. So the two inputs could be 0 and 0, Low and low, it could be 0 and 1. It could be 1 and 0, and it can be 1:1 We've got two inputs, four possible combinations, and you might notice if you know well, you probably don't know binary if you're still watching this and this is a binary count from 0, 1, 2, 3, and I Have to do a separate video on our binary on number systems and the output is a function of these two inputs here. So in this case, an and gate, the output is true or 1 only if both A and and get it, A and B are 1. So according to that rule, our Am B1 know so it's not true, it's A 0 is both A and B 1. In this case, no, it's not is A.m. B 1.
In this case, no, it's not. Are both A.m. B 1. In this case, Yes, Bingo! And that is our truth table for the N gate.
The output here C is only true if both A and B inputs are true. That's it. And just like the name of the gate and was descriptive of its functionality here or is also descriptive of X functionality. So we go in and we write the exact same at table that we had before.
So the combination of very our inputs is exactly the same as the angle. So we write down the four possible combinations. They don't have to be in this order strictly speaking. but by convention they start at zero zero and count their way up and depending on how many inputs you have.
So let's have a look at this. Now the functionality of an or gate is the output is true. ie. the output is one.
C is one if I or or get it, I or B is one. So is A or B 1 in this case, Nope, they're both zero. So our output is zero. Is either A or B one? Yes, there is a one.
So our output is going to be one. is A or B one? Yes, it is. And in the final case here, they're both one. But that's okay because it's an all function.
Is this one one or this one? I Want? Yes. So the output is one that's all gate. and now inverter is incredibly easy to. We only have one input A and we have one output.
B We've only got two combinations of inputs high or low, true or false 1 or 0 and our output. The name once again describes the function invert. so it inverts the basically the inverting polarity is not the correct term, but it inverts the function of the input. So if it's 0 on the input, you get a 1 on the output to 1 on the input, get a 0 on the output.
That's simple. that's our inverter. Now, as far as two input gates go, and in or aren't the only ones, There's another special snowflake which I'll tell you about in a second. But the reason I mentioned these three first is because with and Ands or and inverter gates, you can create any other gate or combination or digital system whatsoever.
These three are the ones that you need to do all that actually. Strictly speaking, that's not true. You only need the not and the Or or the not and the end. you can create any other logic, gate or logic system possible.
Okay, so we're going to look at a kind of a special snowflake one here called the XOR or exclusive or that's what the X stands for exclusive because. Well, it's very exclusive gate. but it is. Also, you know, a common gate used so it should get a group together with the other types of two input gates. So and Or and XOR other three main types of two input gates. So let's take a look at the functionality once again. A B C C Z is 1 2 3. Dumi sorry I shouldn't subject you to singing.
We've got our inputs just like before. Oh sorry I forgot that it's not just a blank box like that. it's actually equals to 1. Like that, that's our ICC exclusive or symbol.
So the exclusive all function is almost identical to the all function over here, but it's exclusive. Which means that it has a special functionality now just like the or gate. If I or B is 1, then the output is 1. but with the exclusive case and I Guess you can You know have a different description for this but the exclusive case of that only when I or B is 1 is the output 1.
So in this case is A or B1. No. So we get a 0 is A or B1. Yes, we get a 1 is A or B1 Yes, we get a 1 is A all B1.
In this case for the or gate, it would have been a high, but in this case it's going to give us a 0. So this exclusive or is actually a very powerful function that allows us to do controlled inversion which I might explain later, but yet there are three types of two input gates and or XOR with the knot. Now what we can do now is actually combine the not or inversion function without other three two input gates to give us a What? Accord In voted to import gates and these are called the NAND gate, the nor gate and the X. Well, there we go: X nor a gate and N4 not.
So it's exactly the same, but we've added the symbol is now adding that knot that circle on the output like that that I showed you before. So that's actually equivalent to getting a physical and gate like this and sticking and inverter on the output like that. In fact, you can do that. You can get a physical NAND gate chip, you can get a physical inverter chip and you can put them like that and it's exactly the same as buying a NAND gate chip like that because that's all it contains inside the chip is it's got an extra inverter not circuit on the output.
Now you might think hey, do we have to learn more truth tables for these gates up here and NAND Nor and X Naught? Well, yes you do. But if you've learned the truth tables or you can derive the truth table for and or and XOR here, then you can do the same for the land because we've just added remember this inverter on the output so we can just take our output here which is C and what do we do? All our imports have stay the same. They haven't changed, but in this case we'd have a 1, 1, 1 and a 0. So that is for our NAND function.
So that's all you have to do a likewise here: 1 0, 0, 0, and 1 0 0 1 for the X nor an D Nor gate. Simple, You just invert the output. So let's actually look at a timing diagram because you're probably familiar with the oscilloscope where it displays voltage versus time. Well, we're just going to look at logic level versus time. So let's take for example the look. Let's take for example, the NAND gate here. like this: Okay, we've got a B and C is our output now. I'm going to draw some signals in here and it's going to do these completely randomly and we'll see what we actually get out.
So if I go like this I don't know. Do it. There's a little grunty pulse like that and okay, we've got a signal on a like that and let's do B I Don't know. Haven't really thought about this at all.
Let's see how it works out. So let's look at these two waveforms and see what we get on our C output here. Using our truth table for the NAND gate, we started out okay. this is a K is 0 and 1.
Okay, 0 and 1 and 0 and 1. So let's have a look. They're both low. Okay, you remember the outputs only going to be high when both of them are high.
so it's going to be low like this. And in this case, well, we can sort of do some dashes down there like this to indicate the timing. Okay, so let's actually do the timing for each transition like this and we can go down and go across and do it. Now, we're following time here.
so this input is 1, this input 0. So according to the truth table, we're still going to stay 0. It's only when we hit this point here where they're both 1. Bingo that this will actually transition to a 1 like that and we'll stay 1 until this point here where the A input drops down low.
So therefore the output must drop down low with it and we won't see a high again until you guessed it, roundabout here. But it'll only stay because if you follow that down, only a very brief period where they're both high, will that go high? but in this case is gone low. so that's going to stay low. Oops.
it's going to go high again because they're both high. Look at that and it's going to stay low and low and low until this point here where it goes high and down again. So that is a timing diagram and you can see the relationships. So now, if you actually physically hooked this gate up on your breadboard and fed into digital C north like this, With this timing, you would get that waveform on the output.
You'd get a you know your five volts or 3.3 volts here And you zero volts. They're too easy. So you might have some ridiculously complicated logic circuit with hundreds or thousands of these gates. It's all going to follow these basic truth tables.
You've learned nothing more and there's no more magic to that. That's all there is to analyze in digital circuits. And likewise, if we had a NAND gate there instead of A and gate, we have simple NAND gate. You guessed it would be the inverse of that because it's got that, not on the output.
Everything is totally look now bit how you're doing there you go totally inverted. You get the idea. Now we get on to and I Hope you don't lose people Here we get on to what's called boolean algebra. Yes, algebra, but in a boolean digital logic form. Now in this case we would, the output would not be called. well, it's still called see. it's labeled see here. But we put what's called a bar on top it to signify that it's inverted.
So we'd say not C output or an inverted C output and these things will tie into boolean algebra. Let's go now. What we've been looking at here is what's called boolean logic. Boolean are named after George Boole Back in the eighteen hundreds, he came up with the idea that you know you can describe a system that's either 1 or 0 high or low, true or false.
And that's so. this is boolean logic. But now we're going to look at boolean algebra and learn how we can express all this sort of stuff you know, practically in tables. We can actually express this mathematically, and trust me, it's not hard.
Stick with me. So just like we have mathematical operators you're familiar with + - you know, multiply, divide that sort of thing. We also have boolean operators that describe the mathematics of boolean logic. So let's take the case of a simple NAND gate sorry and and gate here like this: Ok, input a input B there and our output.
Well, our output we labeled C before. But let's do this mathematically to. the output is A and and is represented. Here's the operator for and as a dot.
So I end B Like that and that's all there is to it. That is the boolean algebra expression for the and gate. Ok, so I'll just redraw that here a and B like that, and let's feed the output of this and gate into the input of an or gate, shall we? So we'll draw our or gate here. and let's call this input C because this input here is A and B.
It's the output from that and gate and this one is just input that will call C. Now what? How do we describe mathematically this output here? Ok, we could call this output DS For example I've call it X or anything you want or just don't call it anything at all like we did here. It's just Amb. So the expression for the output of this combinatorial logic.
It's called because we've combined different logic gates. So it's called combinatorial logic. So D equals A and B or the operator. The boolean algebra operator for the or gate is a plus.
C That's it. That is our boolean algebra expression that describes this gate. So you don't actually have to draw these gates. If you just said D equals A and B or C then that describes the functionality of that circuit.
It's very simple now. just like in regular arithmetic that you're used to, there's an order of operations. For example, you might be confused. Is this actually A and B or C Or is it a and B or C Ie, do B and C go to the input of an or gate first order.
They go to the input of an and gate first. So I like B and C is that like these things actually swapped around. Well in this particular case, if you wanted to be really clear, you could put parentheses around A and B there to show that. But in boolean algebra it's assumed that the A and that the and function is going to be performed first unless otherwise stated. So you could actually if we actually put I if we put parentheses around there like that, then that would imply that we actually had an all function like this and we had B and C and that was going into and an end function. But with input A here like this: if you draw the parentheses like that so you know the order of operators matter. So if you want to be really clear, then put the parentheses in. Now let's not forget the knotch symbol, shall we? Let's say that we added an inverter on the input here like this: how would you describe that? Well, the inverter, like I said before, uses the bar approach.
so we will put a bar above C and that signifies that it's inverted. That's all there is to it. And likewise, if we put a knot on the output here of our entire function so D then we would put a bar right across the entire expression like that. Beautiful.
So that shows that we've got an inverter on the output. Fantastic. Okay, so our logical operators you see in the end is a dot and the or is a plus and the knot is a bar on top of something, So it'll be A and B a or B and just not A or it could be a plus, bi or B and not that. But we're forgetting the Xor gate.
our special little snowflake here because it's pretty close to and or it is I a plus B I Shouldn't say plus, it's I or but you know and like it's have it, you see it and you say plus even though you mean B. But because it's a special snowflake and we need to signify the XOR symbol is just a circle around the or or the plus. Easy. Okay, so let's say forget boolean algebra for a minute.
We'll come back to it in a second. Let's actually analyze a logic circuit like this: a combinatorial logic circuit. In this case, we've got three inputs A B C and we've got our output here. We'll call X for example.
Now, I Said before that you can have more than two inputs on any of them. Any of your two input gates you NAND nor your X or your names and or exclusive or all that sort of stuff, you can have more than one. In this case, I've got a three input and gate. it's called.
So although you may not have actually seen the truth table for this, you can derive it because you would have an extra input over here on this table. so you would you know you would go 0, 0, 0 0 and then you start 1, 0, 0, 0, 1, 0, 0 1. For example, and up. What am I doing There we go 1 and 1 like that.
So you would just count up for a 3 input gate and you do the functions on the output. But once again, if all of and all of the inputs are 1, this input and this input and this input a 1 then the output is 1. So let's try and work out what our output expression will be based on this input, shall we? So let's have a look here. this is A and this is B. So this is A and B. Okay, so this is just as basic two input and gate. Now the output here is a little bit harder. What we've got is we've got not A like that and B and C.
So we've got these two boolean algebra expressions. Now now we can figure out what X is. So X is equal to A and B. Or we'll put parentheses around these A and B.
Or because it's an or gate. You guessed it. The other expression on the input I and B and C like that. Bingo and say if this was an or gate, well it would be that function with a big knot over the top of it.
Beauty. So that is basic digital logic and I'll call it quits there because this is long enough already and we'll need to expand this topic into boolean logic simplification and how you can actually simplify your circuits using De Morgan's theorem and Carnot maps and other techniques to actually simplify logic because you know if you've got a hundred different gates in here. if you can get away with you know, minimizing that to fifty gates, then you're going to save either the number of chips you're going to say, silicon space, you're going to save all that sort of jazz. But I hope you are learnt basic introduction to digital logic there and it's not that hard at all.
Once you know your basic logic, gate types is not many of them, learn how to derive the tables. Also, they're not hard to memorize because it's in the name or and you know, exclusive or is probably the little special snowflake one in there. but it these things. I'm not difficult at all.
So anyway I hope you enjoyed that. If you did, please give it a big thumbs up. And because this is the first video of this type, let me know what you think in the comments down below or over on the E V Log form. And if you'd like to see more of this content, possibly on a second channel, if you think that's a good idea, let me know anyway.
I hope you found it useful. Catch you next time.
Yes! I'm always going over fundamentals cause I'm old and electronics is hard. Thanks!!
This guy is funny ๐
I love you dave jones!
I love you dave jones!
goat
whatever anything
EXCELLENT!
Please, continue with this awesome job with the EEVacademy!
Are u going to make advance topics in digital electronics?
Very nice video…
Yeah keep going you're so freakin good ๐โ๐ฝ
Logic gate truth tables can be boring, until you find a use for them.
An XOR gate is an extremely useful device for turning a single channel oscilloscope into 2 channels, for viewing the timing relationship between 2 digital signals. Either signal may end up inverted on the scope display of course, but the timing relationship between the 2 is clearly visible on screen.
Absolutely great work ๐
I'm confused as to why the AND gate has 10 transistors. I was taught that NAND gates have 4 transistors and AND gates have 6 because they are a NAND gate with an inverter. Is this a simplification they tell new EE students?
"you probably don't know binary if you're still watching this"
me: is bored and listening while doing PCB layout
I definitely prefer A โง B โจ ยฌC
Jeez this would have been helpful last term
Thankyou Sir
Wow
Thank you! This video really help me with logic gates
Liked & Subscribed = A.B = 1 You've got one more subscriber! The best tutorial so far on YouTube! Thank you very much for your work and I would like to see some more tutorials from you. Keep it up!
Love to see someone teaching with passion
Finally DaveCAD on a mobile device.