How to use the Do-more PLC and Do-more Designer Software in a DirectLOGIC PLC System
Live demo showing you how to use Stage Programming with PLC ladder logic and PLC programming on the Do-more PLC.
Check out all of our videos at https://www.AutomationDirect.com/Videos
To subscribe: https://www.youtube.com/user/automationdirect?sub_confirmation=1
**Prices were valid at the time the video was released and are subject to change.
Ladder programming is ideal for taking lots of inputs and using those inputs to control lots of outputs. Ladder logic can also be used to manage sequences of events, but it does involve some additional interlocking, control bits, and housekeeping logic. Stage programming doesnít replace ladder coding, it makes it easier to use ladder logic to control sequences of events. Letís look at a side by side example comparing the two methods. Picture a drill head mounted on a carriage. We want the carriage to move out to a fixed location, the drill to move down and drill a single hole, the drill to retract, and the carriage to return ëhomeí. Hereís how you might do that in ladder ñ note that this is simplified for example purposes and is NOT intended to be a fully implemented or tested code set. Weíll run this in the simulator over here so we can follow along. Letís turn that on Ö put it in run mode Ö and letís turn our status on se we can see all of the bits. On Rung 1 we make sure the Carriage is pulled back in and that the Drill position is up. Weíll simulate that by punching X2 and X4. OK, our system is ready to go and weíll accept the start button from the user. When the user hits the start button - which is our X1 input ñ we turn on the move out interlock. That tells the rest of the system that the carriage is moving out. And we turn on the motors so the carriage starts moving. When the carriage starts moving this IN limit switch is going to release. So weíll do that. And that moves us down onto this rung. Rung number 2. Now this rung is enabled with this interlock bit until weíre waiting until the carriage hits the OUT limit switch. When that happens, X3 gets set, we turn off the motor moving the carriage out, We turn off this rung, We enable the interlock to the next rung, and we turn on the Drill Down Motor. Now all future scans will ignore this rung, and weíll come down and run this one. So now the drill is moving down, which will release the UP Limit Switch, and when it hits the DOWN limit switch, X5, It stops the drill from moving down, turns off this rung, turns on the drill moving up and enables the next rung with this interlock. As the drill starts moving up, the down limit switch will turn off, and eventually we will hit the upper limit switch, X4. When that happens, we stop the Drill Up Motor, we turn off this rung, we turn on the motor that moves the carriage back to the home position, and we turn on the next rung with this interlock. As the carriage moves back in, it will release the OUT limit Switch, and weíll move down to the next rung. Now only this rung is enabled with this interlock bit. And it is simply waiting for the carriage to come all the way back in. When that happens, it turns off the carriage motor, and it turns off the MoveBack In interlock. And of course by now the user would have let go of the button, hopefully Ö And we are right back to the beginning of the ladder logic where both limit switches are set and we are waiting for the user to press the button. Weíll, thatís not too bad, especially when you give each control bit a good nickname like you see here. Now letís do the exact same thing in stage programming ñ with one exception. The Stage Program code is in its own code block called ìDrill_1.î Iíve also made multiple copies of this for something we are going to do later. Drill_1 is enabled back in main. On the first scan, we enable that drilling routine, and it runs continuously until the PLC is turned off. So we are just going to focus on Drill_1 so we can do a side by side comparison with the Ladder Logic we just saw. Weíre going to run it in our simulator, so letís turn him on, and letís turn on the status bits so we can see whatís going on. The first rung is just a comment, so you can ignore that. The second rung is our first stage. As you can see from the status bits, this stage is enabled. The cool thing about this is - over here in program view, if you open up the program code block ñ you can see exactly which stage you are in. In stage 0 ñ just like the ladder code ñ weíre waiting for the motor carriage to be back in and the drill to be up. Letís go ahead and force that by turning on those bits. When that happens, Stage 0 transitions to stage 1. So Stage 0 rungs are no longer run, and every time we come into this code block, we only run the stage 1 ladder code. In Stage 1, we are waiting for the user to press the start button. Letís do that. Iím going to press it and release it. What that did, is it started the motor to move the carriage out. As that starts to move, the IN limit switch is going to release. And eventually it hits the OUT limit switch at X3. When that happens, we turn off the motor, and we transition to stage 2. Now these rungs will no longer be run, and the stage 2 rungs WILL be run. And again, you can see here and here which stage we are in. In stage 2, we unconditionally enable the Drill Down motor, which is going to release the UP limit switch, and eventually hit the down limit switch. When that happens, we turn off that motor, and transition to Stage 3. In Stage 3, we unconditionally turn on the Drill Up Motor, which is going to release the drill down limit switch, and eventually hit the Up limit switch, X4. When that happens, we turn off the motor, and we transition down to Stage 4. In stage 4, we unconditionally turn on the motor that pulls the carriage back in Ö which is going to release the OUT limit switch, and eventually hit the IN switch. When that happens, we turn off the motor, and we jump back to Stage 1. Letís go up there and look. In stage 1, we wait for the user to press the button, and we start the sequence all over again. We didnít need to go back to stage 0 because we know the motor is in and up. So we can go straight to Stage 1 and wait for the user to press the start button again. As you can see, both ladder and stage are very similar. But with stage we didnít have to create and manage a bunch of interlock bits and logic ñ stage did it for us. And hereís a real big advantage of using stage: Suppose we have a number of these drilling heads. With Stage, I can simply copy this entire code block and paste it into another drilling code block like I did here: Hereís Drill_1 and Drill_2 Ö Look, this code is identical to the code we just looked at. Now, of course, in this new routine all of your motors and limit switches would change, but what Stage saves us is, having to create a whole new set of interlock logic and interlock control bits. We get to reuse these S-bits because they donít interfere with the S-Bits in the other code block. So you can see while I have S0 through S4 here, and S0 through S4 here, and S0 through S4 here, none of these interfere with each other. These S-Bits are unique to this code block. And thatís where stage saves you a lot of time and headache when you are setting up sequences of events. With Ladder you would have to create a whole new set of control bits for each code block you create. And of course, the other cool thing is if multiple of these heads are running, you can see what stage each head is head is in, in real time as the program runs. Thatís really handy when you are trying to figure out what is going on. Not having to worry about all of these control bits and interlock logic, is especially helpful when you are trying to control sequences of sequences. Imagine having to keep up with all of THOSE interlock bits. So again, you can use stage or ladder to manage sequences. Stage just makes handling sequences easier when creating the sequencing code, when debugging the sequencing code, and when maintaining the sequencing code. A word of caution, though Ö make sure you fully understand ladder BEFORE trying to use Stage. Stage doesnít replace ladder, it just helps manage it. Well, that should be enough to get you going. Please send us any comments or suggestions you may have. We appreciate the feedback. Spend Less. Do-more. From Automation Direct.