In this lesson we are going to show you several ways to program start/stop functionality for a motor.
As most of you know, we are against giving you clear rules and methods in programming since one of the advantages of programming is there are nearly limitless possibilities. Users have said that it would be nice if there were at least some guidelines to help them choose a method for programming something such as a simple Start/Stop configuration of a motor.
It should be that simple, shouldn't it? You have a Start Button, you have a Stop Button, and you have a motor...here's how to program it. It isn't that simple. Each situation should be evaluated to determine which is the best way to write the code.
However, here are four examples of a Start/Stop motor program. Two of which we would use, one we wouldn't, and one we feel is incorrect.
A. "Seal in" circuit with a normally closed Stop Button.
Right off the bat many will correct me and say that we have accidentally put a "Normally Open" instruction in the program. There is no error in the program and yes, we have a normally closed Stop Button wired to I:0/2. We are using an XIC instruction to look at I:0/2. This is the most basic and fundamental instruction in RsLogix, yet it is completely misunderstood. The normally open electrical symbol -||- is NOT the same as the -||- XIC programming instruction. Allen Bradley's documentation is even misleading. "This instruction (also called "examine on" or "normally opened") functions as an input or storage bit." The problem is, they are trying to help users relate to something they understand, in this case electricity, yet it isn't. It is ladder programming.
Now that you've got that out of the way, back to the Motor A sample. In fact, here is the above image again just so you don't have to scroll up to see it.
Pressing your normally open Start Push Button will put a 1 in the I:0/0 data box which will in turn allow the XIC I:0/0 to be evaluated as true, making the OTE O:0/0 true, putting a 1 in O:0/0's data box which will turn on Motor A. Now when you let off of your Start Button, the top branch will be false but the bottom branch will "seal in" Motor A as long as your Stop Button isn't pressed. Motor A not running had kept the bottom branch from being true till the motor started running.
Note when comparing to Motor B. I'm trying to keep these explanations brief, but the advantage of the normally closed Stop Push Button compared to the normally open Stop Button is that if power fails or a wire is broken on the normally closed circuit, the XIC I:0/2 in Motor A's bottom branch will no longer be true, turning off the Motor A output.
B. "Seal in" circuit with a normally open Stop Button.
This code works identically to Motor A's code with the exception that the XIC of the normally closed Stop Button has been replaced with an XIO of the normally open Stop Button. We see this an alarming amount in new programmers code and in textbooks. Again people are trying to relate the electrical circuit for a Start/Stop control with ladder programming. While functionally fine, this method has a severe safety concern in that if you lose power to your Stop Button, your Stop Button breaks, or a wire breaks to the PLC input (all common on real equipment) then the bottom branch will remain true and the motor will continue running. PLCs should not be relied on for safety but it doesn't hurt to design the circuits and programming for the highest level of safety as an extra layer of protection.
C. Motor A's circuit with the Stop Button moved out of the branch.
Here I go, already contradicting myself. I just said that the circuit and code should be designed with the highest level of safety in mind. This may be safer than Motor A's in theory and functions very similarly.
Yet it lacks a key maintenance feature that many motors need. The ability to "bump" a motor for testing, lining up tooling, or maintenance. Right or wrong, maintenance personnel will intentionally hold the Stop Button so that the Start Button acts as a way to momentarily start the motor, with it stopping the moment they take their finger off of the Start Button.
By moving the Stop Button out of the branch and disabling this feature, it requires pressing the Start Button then the Stop Button to "bump" the motor. This could cause more of a safety issue than it solves depending on the application but it will also lead to maintenance personnel bypassing all safety features to get the job done if they are not able to bump the motor with normal control. Usually this is done by pressing a screwdriver into the front of the contactor, a clear safety violation and very dangerous.
D. Latch/Unlatch
We usually discourage beginners from using this method, but not because there is anything wrong with it. In beginners, this usually results in "spaghetti" code because they can "control" the output from multiple locations and won't fully be able to follow their code.
It is perfectly acceptable and functional. Nearly identical to the functionality of A with a twist...
Again I've only listed four methods but for me it comes down to method A or D. There is a very important difference between these two methods that we have a separate lesson on later when we talk about what a PLC does when you cycle power. Method D's motor will resume running without any operator intervention. Even then, your initial reaction will be to say that method A would be safer since the motor would not restart when power resumes. But what if it were a cooling pump at the Fukushima nuclear reactor after the tsunami? Again, every situation must be evaluated to determine the best code.
Four methods, each containing 4 of the simplest instructions in ladder logic, yet such a complex answer. At this point you should have a good grasp on XIC, XIO and OTE instructions plus more importantly you should have a firm grasp on how a PLC scans and executes these instructions.