Hey guys it’s matt bringing you the next episode of logical redstone today we’re going to be talking about encoders and decoders and by the way this video is going to have a lot of connections to binary but if you don’t know binary yet you should be able to understand this Video just the same it’s just that it’ll be a little bit easier if you already know it in the next video of the series i’m actually going to be going over binary more extensively so if you want to wait for that you can do that as well Let’s get right into it so first we have encoders an encoder is a device that takes in one input at a time and it outputs a code that resembles that input in other words it takes one input and it encodes it the letters a b c d represent The inputs on this encoder and these three arrows are the three outputs that make up the three digit code that’s going to be outputted for each letter and in general encoders can have any amount of inputs and any amount of outputs in this specific diagram the Inputs are a b c and d so we have four inputs and like i said before you can only activate one of them at a time we have three outputs which is telling us that no matter what input we turn on we’re going to get a three digit code coming out For this specific encoder this is the truth table so if we put in a we want 0 0 1 to come out if we put in c we want 0 1 1 to come out and in practice it looks like this you have lamps with levers just like the Logic 8 video if we input a we get zero zero one on the output like this okay so let’s try to make one i made this little circuit here which has four lamps for the input and three lamps for the output the input lamps are a b c and D just like the diagram and let’s make this truth table come to life in this circuit so when we flip a again we want this life to turn on or for example if we flip d we want it to get d’s code which would mean this intuitively we can just connect Them up so a only needs to go to the one on the right so we take his line connect it to the one on the right b only needs to go to the one in the middle so we take b’s line connected to the middle you can bring it over with a bridge C goes to middle and the right so you put it into here and here and make sure to put repeaters here so that they don’t interfere with anything and then d of course goes to the one on the left and you can connect it with a big bridge like this And technically we’ve just finished our first encoder so a gives the correct code for a b gives b’s code c and d so congrats i’m making your first encoder but there’s a problem here the problem is if this encoder gets any bigger it’s going to get a lot messier Really fast you’re going to end up having bridges on top of bridges you’re just going to have a lot of messy wiring that’s really difficult to work with or to debug and so we really want a design that looks a lot neater is just more organized and it’ll be a lot easier to Look at the way we make this much better encoder is we take the output lines and we bring them all the way back like this then you take each input line and you put it into a torch or not gate and you bring that line above all the output Lines like this with dust on top now all you have to do to finish your encoder is put torches on the side of these blocks that correspond to the code that you want for example with a we want the code to be just the one on The right so all we do is look at a’s line and put a torch on the side of this block which is right above the line for the one on the right and now when we flip on a it’s going to depower this torch which depowers the entire line and any torches That were attached to this line get turned on let’s just continue these codes it’s really quick to do now b is right here c is here and d is here and we’re done that’s it a will give the right code b will give the right code everything works perfectly Yeah this design is just way better i mean if you can see the codes with the torches super organized it’s flat compact you won’t have to deal with bridges or anything like that and yeah the only thing you have to worry about is if these output lines get really long You do have to have a repeater on them obviously but that’s pretty much it i would just recommend only using this unless you have a really good reason not to moving on to decoders so they basically do the exact opposite of what an encoder does they take a code as an Input and they give one output at a time so in this specific diagram if you put in a’s code you get a out if you put in b’s code you get b out just like before with encoders you can have as many inputs as you want and you can have as Many outputs as you want what this is telling you is the amount of inputs you have that’s how big your code is so right now we have three digit codes coming in at all times the output size is how many different things you can actually output using different combinations of codes And this is our truth table for it it’s literally the exact same truth table as last time except just flipped if you put in the code for a you get a out if you put in the code for b you get b out 0 1 0 should output b All right let’s try to make a decoder so this is our circuit for it i basically just copied the diagram again we’ve got three inputs for our code and remember we’re making decoders now so we can have any amount of these on at a time and our output is the letters so we’ve Got a b c or d we should only see one of these come on at a time decoders are a little less intuitive to make but let’s just try it so we want the zero zero one code to line up with a so if we put in zero zero one we want This to activate a so okay i mean i guess i can just take this wire and connect it to a that seems fine right unfortunately this is not good enough because here’s the problem if we take that logic and follow it to b okay now i put in b Which is just the middle one i would bring it over here and activate it like that so a works b works but what is c c is both the first one and the second one wait a second the first one and second one i already reserved for a and B yeah that’s a problem that’s not what our decoder is our decoder only activates one output at a time in fact it was already broken with a and b on their own because you can have a combination that activates both a and b that’s a no-no so Clearly we need something a little bit more complicated for decoders to actually work properly the way i’m going to try to explain it to you is with a combination lock so imagine this is a lock to your house your garage or something and the only way that it opens Aka this being on is with a certain code inputted right here so right now the only time this opens is when you have the code zero zero zero zero because as you can see if anyone tries to guess the wrong code it doesn’t unlock you need it To be this specific code and the reason this works is because the only time it outputs is when all these are off if you remember when we learned about and gates you need all these to be off and then the final or torch can turn back on if Any of these are not off the torch turns off and that’s the wrong code and we do not get an output now instead of the code being zero zero zero zero what if i wanted the code to be something else like zero zero zero well Let’s turn on 0 0 0 1 and remember we want all of these to be off in order for this torch to turn on so the way we do that is by replacing this repeater with a torch and now it works as a combination lock for zero zero zero one If we have any other combination it doesn’t work anymore so this is fantastic we found a way to make a combination lock to detect for any combination we just put torches where we want the actual ones in the combination to be if the combination was 0 1 0 1 you would have repeater torch repeater torch and now look i can’t unlock it unless i put that exact code zero one zero one boom and this is exactly what we want for a decoder that’s what a decoder is doing it takes your input which is a code and It only outputs when you have that specific code so let’s apply this and put it onto the actual decoder over here first thing you do to make one is extend all the output lines all the way back then you take each input line and you Need to raise it up so it gets up to elevated level again but then you want to basically make it snake like this then you want to put repeaters behind all the output lines so here here here and here and then put dust on top of Here okay so it should look like this now what you need to do is for each code you need to replace the repeater with a torch just like i did on the combination lock so for a we want it to be 0 0 1 so we go to a’s Line and replace this repeater which would have been powering a and turn it into a torch on the side of this block just like this for the b line we go back and follow it out and we want it to be zero one zero so we take this repeater Which would have been powering b and we turn it into a torch that now powers b for c we want it to be zero one one so we take these two repeaters replace them like this and two torches for d we want one zero zero so just like everything else looks like that And the final step is to take the outputs and invert them because you remember at the end of my combination lock i had a torch that was oring all the inputs together and there we go that’s our finished decoder so now if we type in a specific Code let’s just try c for example 0 1 1 we get c if we type in the code for b which is just 0 1 0 we get b awesome last thing i want to show you is how these might actually get used in your circuits because i mean They’re pretty cool but it’s not really obvious why they’re useful at first so i just want to show you a few examples the main reason i think and i think this is probably the most popular reason in real life to use them i’m not exactly sure because i don’t actually have a Degree in this stuff but i think it’s to actually uh make the amount of lines that you’re using smaller right because if we want to transfer seven lines over a long distance you can actually encode them into just three lines and then you can decode those three lines back out into seven So for example if we want to transmit uh this one check it out it traveled over the three lines with its three-digit code and it came out in the exact same spot over here so yeah to save space i think that’s a really really nice reason to use encoders and decoders and then Here’s a cooler looking example what we’re doing here is we’re taking four inputs one two four and eight if you know what binary is that means we’re inputting a four bit binary number that binary number is getting decoded into a number zero through nine so we have ten lines total here and then Once it decodes into that specific line it then encodes into the segments of that number on a display so right now we have none of these on which is why it’s displaying zero if we turn on just the one it gets decoded into the one line see How this second line is off now and then that one lines torches turn on which are the ones segments so we input a one and we get a one on the screen if we wanna put in a five we can do that by inputting four and one Which again gets decoded into a 5 and then encoded into segments and it looks like a 5 on the screen so this is a really organized way to make a 4-bit binary to 7-segment display machine that’s it i hope you enjoyed i hope you learned something as always the World download is in the description for you to try out Video Information
This video, titled ‘Encoders & Decoders | Logical Redstone #2’, was uploaded by mattbatwings on 2021-10-14 02:24:18. It has garnered 128570 views and 5965 likes. The duration of the video is 00:12:52 or 772 seconds.
!!! Check out the NEW AND IMPROVED logical redstone series here! https://youtube.com/playlist?list=PL5LiOvrbVo8keeEWRZVaHfprU4zQTCsV4 !!!
In this episode, I go over encoders, decoders, and a few applications of them.
Patreon: https://www.patreon.com/mattbatwings Discord: https://discord.gg/V5KFaF63mV My socials: https://linktr.ee/mattbatwings My texture pack: https://github.com/Xyverle/MattPack World Download: (JAVA 1.16.5) https://www.planetminecraft.com/project/encoders-amp-decoders-from-tutorial-video/
————————-
Want to get more involved in the logical redstone community? Learn Logical Redstone! https://youtube.com/playlist?list=PL5LiOvrbVo8keeEWRZVaHfprU4zQTCsV4 Open Redstone Engineers (ORE): https://openredstone.org/
0:00 Welcome to Episode 2! 0:21 What’s an Encoder? 1:30 Making an Encoder 4:34 What’s a Decoder? 5:27 Making a Decoder 10:32 Applications of Encoders & Decoders 12:34 Subscribe!
Music: https://youtu.be/mWebB6zby6Y