How to Create a Sequencer using Shift Registers (SHL) with Siemens TIA Portal!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome back everybody today we're gonna be learning how to create a sequencer using ladder logic inside of the siemens s7 1200 PLC using Ti a portal now before we get started what I want you to do is I want you to give the video a like in comment below what you'd like to see on our next video next week now as I mentioned we're going to be creating a sequencer if you're not too sure what a sequencer is think of most automated processes most automated processes have a start position and an end position and they go through a series of steps to reach that end position and when they've completed the process then go back to the start position and then repeat that process a classic form of a sequencer is what everybody knows a set of traffic lights now a set of traffic lights has the sequence of red turning on first waiting a period of time and then turning on the amber yes we're going to use the amber today then after that Amber is being on for another set period of time we then turn off the red in amber and then turn on that green light to let the traffic start flow let that run for a period of time turn off the green turn back on the amber wait another five seconds or so and then turn off the amber and then go back to red and let it repeat the stages again that there is a classic form of sequencer and that's what we're gonna show you how to create a day let's get started okay so I've got Ti a Portland for it to me already I've already created the hardware so we don't need to go through that we're just gonna jump straight into the program now when we're creating a sequencer you don't have to use a lot of logic to create that sequence so you can use what we call SFC which is sequential function charts or sequential flow charts however you like to say it now we're gonna show you Lana logic the day just because it's a very straightforward programming language and a lot of people use it on the shop floor now when we're creating a sequence are using ladder logic what we're going to be using is siemens shift left instruction now what a shift left instruction does is it shifts bits within a byte a word or a double word left a certain amount of bits depending upon what we set it up as now what I want to do is I want to show you how we create this so you get a little bit more understanding of this so the first thing that we need to do is set up the shift register now we need to think about how this set of traffic lights works we turn on the red first right okay do we have any push buttons for this traffic light to run the answer is no we just have three outputs we have red Q zero zero amber Q zero dot one in green Q zero - so how do we start this process up when we've got no push buttons or what we can do is we can actually use the PLC outputs think about the PLC outputs on the very first scan of the PLC on the very first scan of the PLC all of the outputs are going to be a logic 0 they are all going to be off so what we can do inside of network one is we can say that if the red lamp is off if the amber lamp is off and the green lamp is off we are at the start of our process so I'm just going to type in here Q 0 dot 0 Q zero dot one and Q zero dot - and I'm going to rename these tags red amber in green and at this point here what I want to do is I want to load my shift register with the value one this is gonna turn on the very first bit which is gonna be our very first step so to do this open up our instructions wind on the right hand side opened up our move operations and drag and drop move into Network 1 and what we're gonna do here is we are going to move the value 1 into M V 0 okay rename MB 0 and we're just going to call this the sequence of steps all right the next stage is to then trigger our shift register and the shift register the shift left instruction is inside of our shift rotate folder open that up and you will see shift left you'll also see shift right so this is if you want to move the bits or right within the binary but because binary works from right to left we want the shift the bits left so what I want us to do is drag in our shift left instruction at the network too and I want to add in a signal before this and this signal before this is gonna be our strobe signal our trigger signal which will shift the bit left when it's completed its step so I'm just gonna give this the M bit M 10.0 and what we'll do is we'll just rename this strobe and like I say every time a step is completed this strobe signal is gonna be triggered and that there is gonna shift the bit one place to the left now what we need to do is we need to tell it which register we're gonna be working with and the register that we're gonna be working with is mb0 that's our sequence of steps and it's gonna ask us how many times do we want to shift the bits left and we only want to shift them one positioner and we're gonna shift them into memory byte zero again so what will happen here is when the red lamp is off the amber lamp is off and the green lamp is off one is going to be lowered into M V zero and the way this will look inside of the plc memory is like so memory byte zero and it will look like that and that bit that is on is M 0 dot 0 okay we are in memory by 0 and that there is the very first bit in memory by 0 which is M 0 dot 0 this is gonna be our step one step one is then going to control the first part of our process and when it's completed it's gonna trigger our strobe signal which is then going to shift this bit here one place to the left so what it will look like is this and that bit that will then be on is M 0.1 in M zero dot one is gonna be our second step when the second step is completed it's gonna trigger our strobe signal once again M 10.0 and that there is going to shift the bits one place to the left once again and our binary will look like this and that there is M 0 dot 2 and so on and so on so in network 3 what we want to do is we want to have the sequence of steps for our process so we start off with our step 1 which is M 0 dot 0 and we'll rename that of step 1 there we go and step 1 is going to be completed when the red lamp is on the amber lamp is off and the green lamp is off then we can trigger our strobe signal so what I want to do is I want to tie this to our red our amber and a word green then tie this to our M 10.0 which is our strobe signal now what I want to do is I only want the trigger this once for one PLC scan so I'm just gonna drop this coil down and I'm gonna select the P the one shot pulse positive and I'm gonna give this a storage bit M 1 dot 0 and that there is this gonna be our storage bit for our one shot pulse SB 1 there we go the next step step 2 is then gonna wait until the red lump is on the amber lamp is on and the green lamp is off so when the red is on the amber is on and the green lamp is on that then is when that step is completed so I'm just gonna drag that up and that will then trigger the strobe signal again for one PLC scan shifting the bit one place to the left which will then turn on step 3 we'll just rename this step step 2 there we go and then we'll start on step 3 so m02 will then turn on rename that step 3 there we go and step 3 will be completed of when the red lamp is off the amber lamp is off and the green lamp is on again drag that up to the top rung and red green just label these contacts and that then will then trigger the strobe signal again shifting the bit one place to the left turning on step 4 M 0.3 rename that step 4 there we go and that there is going to be completed when the red lamp is off the amber lamp is on and the green lamp is off so red amber green now we haven't controlled any of these outputs just yet but the control part is gonna happen later so then in lead that will then trigger step five like so and we'll just rewire the tag to find the tag as M 0.4 there we go and that there is going to be completed when the red lamp is off the amber lamp is off the green lamp is off when that's happened these three contacts will be true moving one back into our sequence of steps starting the whole sequence again starting from step one so that there is our sequence of steps here now we just need to do the control side so the first part is going to control through step one so I'm going to do here is just type in step one and what we want to do first of all is we then want to set the red turning it on and latching it on so what I want to do here is just set our red lump so then what happens is when step one turns on it sets the red step one will then be on the red will end beyond the amber will be off the green will be off it'll trigger our strobe signal Astro signal trigger up here moving the bit one place to the left turning on step two and then the red lump will be on and now we're just waiting for Amber lamp to turn on after a period of time we'll just see ten seconds so here we'll type in m 0 dot one step two and here what I want to do is I want to run a timer for 10 seconds first of all and then after 10 seconds we then want to set the Ambo like that okay so now that the Amber is set what we have now is step two on the read length will be on the amber lamp will be on and then the green lamp will be off which will then trigger our strobe signal once again triggering this contact shifting the bit one place to the left turning on step three now in step three what we want to do is we want to leave the amber on for five seconds like that and then what we want to do after those five seconds is you then want to reset the red lamp reset the amber lamp and then set the green lamp there we go again now we're at step three with the red lamp off the amber lamp off and the green lamp on it's in a trigger or strobe signal once again shifting the bits one place to the left turning on step four and now we need to have the amber lamp on by itself after a ten second period of the green lamp being on so we'll just go at the network seven type in here step four add in another timer what this time is going to do it's going to run the green lamp for ten seconds and then after the ten seconds we then want to reset the green lamp and then we want the set the amber lamp there we go so now the amber lamp is on by itself triggering the strobe signal once again that strobe signal is then going to shift at once again one place to the left triggering step five and now we just need to reset at the amber lamp retaining all the lamps off to then restart the sequence so here step 5 wait 5 seconds that and then we want to reset the amber and there we go and that's it that's that program designed so let's go over it once again just so we understand how it fully works so this network here network one just loads our sequence of steps or register mb0 with the value worn turning on the very first step M 0 dot 0 and that happens when the red lamp is off the amber lamp is off and the green lamp is off that moves worn into our sequence of steps turning on M 0 dot 0 M 0 dot 0 turns on here and it's waiting for the red lamp to turn on the amber lamp to be off and the green lamp to be off so a network for here step one and it's set the red lamp so this contact will be true this contact will be true these both will be false meaning that the current will flow through triggering our strobe signal our strobe signal will then trigger our shift left and it will move the bits one place to the left turning off m0 0 - nay on M 0.1 our step to our step two then wait 10 seconds allowing the red to be on for 10 seconds and then after that 10 second period it then sets the amber step 2 is now true red is now on amber is now on and green is now off triggering the strobe signal triggering our shift register moving the bits one place to the left turning off step 2 turning on step 3 step 3 is now on and we wait for the red lamp in amber lamp to be on for 5 seconds after the 5 seconds we then turn off the red turn off the amber and then set the green triggering the strobe signal once again triggering our sequencer shifting the bits won't press the left then turning on step for step four turns on it then waits 10 seconds for the green to be on it then resets the green and then sets the amber triggering our shift register once again moving the bits one place to the left turning on step 5 step 5 then turns on waits 5 seconds for the amber to be on then resets the amber when it resets the amber the red lamp is going to be off the amber lamp is going to be off and then the green lap is also going to be off which will then trigger our network 1 again moving one back into our sequence of steps turning on M 0 0 start and get all of again and there we have it we have a sequencer controlling a set of traffic lights on an automatic loop without any push buttons to start or stop the process so let's test this out what I want to do is I want to save my project and then I want to download this to the PLC next I want to just load that into the PLC and then I'm going to start all and I'm just gonna select finish now the problem that we're gonna have here is trying to monitor this program just from this block and you'll see what I mean by that in a second when we go live we now have eath networks of try and monitor and keep up with now we could just look at network 3 which tells us exactly which step we're currently on and that will then progress through the stages but a better way to do this would be to simply create what we call a watch table and we did this in our very first video a watch table it allow us to monitor the signals that we want to monitor so what I want to do here is it's gonna open up my watch enforce tables window add new watch table and then I want to start typing in the addresses that I want Amala 10 so the addresses that I want them on at the first of all is my Q 0.0 which is my red lamp my Q 0.1 which is my amber lamp by Q 0 2 which is my green lamp and what I could do is I could then type in m 0 0 0 1 0 2 0.3 0.4 for the steps that are created another thing which we could do instead of that is using M be 0 if I type in m be 0 I can unchanged the display format to binary and what this allow us to do is allow us to actually monitor the bits inside of this memory byte and it allow us to see it shifting the bits one place to the left each time that it's triggered so what I want to do here is I just want to go to monitor all and we can now currently see that the red lamp is on and it's waiting for the amber lamps and I'll turn on and you can see here it's now shifting through the bits the green lamp is now turned on and though a bit is now moved across and then go back to amber and our bit we'll move on more stage across there again there we go after Amber's finished it'll then go back to the start and then repeat the sequence at once again and there we go now you'll notice that you didn't see the very first step turn on and that's because it happened too quickly if we look at what the very first step is our very first step step one is just waiting for the red to turn on the amber to be off in the green to be off and step one all it does is just set the red and that does that of one PLC scan now currently my scan time on this PLC is approximately one millisecond too quick for this laptop to pick up and actually display in our watch table so you'll very rarely see that bit ever turn on it does turn on but you just won't see it turn on just because of how quick it's actually executing now a great thing about using a sequencer is we can start to identify faults really quickly inside of this PLC just by looking at this Network here this network if the process was to stop at any point let's forget that it's a traffic light sequence we can then just look at which step it is currently stuck at in which conditions it's waiting for it to turn on for it to progress through the next step and then we can just work backwards from there so what I'm going to do is aren't you gonna put in a fault here and all I'm gonna do is I'm just gonna put in a normally over contact to stop it from progressing any further forward so what we'll do is we'll go do step four and I'm going to put in a normally open contact here and we'll just address this to an input I 0.0 for example okay now if I saved this project and I'd download that to the PLC the next time it goes through to step four it's not going to be able to progress any further forward because I 0.0 is never gonna turn on and as you can see here we are actually at step four the timer has timed out but I 0 dot zero hasn't turned on so let's just imagine the process is broken down all we need to do is go to our sequence of steps here and we can see instantly that was stuck at step four and it's waiting for the amber to turn on and the green to turn off now what we could do here is we could cross-reference the amber and cross-reference the green or we could cross-reference step four and find out what it's controlling so if I right-click step four and I go to cross-reference information we can see here it's being used Network three in our sequence of events and we can also see it's being used in network 7 to control the outputs so if we just select Network seven it'll take us directly to Network seven and you can see here that step four is on the timer has elapsed so it's not the timer's problem and we can see here that nothing is happening on the output side because this input hasn't turned on so all we would then do is we then you're fault-finding on this input get your multimeter out and let's go to start testing on the electrical side now yes granted this sequence is a small sequencer it's only five steps in length the largest sequencer that we've personally worked on is a hundred and twenty eight steps now that doesn't mean to say gets any more difficult fault-finding on it it remains exactly the same all that's different is you've got more steps to look at all we would then do is again just look down our steps find exactly which step we are stuck at and find exactly which conditions we need to have on for it to progress to the next step and that there is how we create a sequencer using a shift left instruction in a TI a portal now I understand that is a basic sequencer it's only five steps in length granted the largest that we've worked with is 128 steps in the past but I don't want to get too in-depth with these little videos here these are just to give you an introduction to certain instructions in certain programmers and how to use them if you do want to learn more about Siemens dia portal and the s7 1200 PLC's we have both online courses and hands-on training courses on our website if you go to www.mwuclinics.com --nt below and what you'd like to see on our next video and hopefully you might say that next week we look forward to seeing you again I've been Chris thank you for attending
Info
Channel: Scantime Automation & Training
Views: 6,140
Rating: undefined out of 5
Keywords: scantime, siemens, tia portal, step7 professional, shift registers, shl, sequencers, automation, plc, scada, programming, s7-1200, s7-1500, s7-300, s7-400, ladder logic
Id: oHELycSJK_A
Channel Id: undefined
Length: 23min 25sec (1405 seconds)
Published: Fri Jun 05 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.