RsLogix Lesson - Start Stop Motor Programming in an Allen Bradley Micrologix PLC
As most of you know I am against clear rules in methods in programming since one of the advantages of programming is there are nearly limitless possibilities. But I was talking to some students and one suggested 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 really 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 really isn't that simple. As I've irritated so many students by saying, 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 I would use, one I wouldn't, and one I feel is incorrect. Even these explanations are brief and incomplete, I could write a hefty chapter on each one of these. So feel free to comment and discuss at the bottom of the page.
A. "Seal in" circuit with a normally closed stop button.
Right off the bat many people will correct me and say that I have accidentally put a "Normally Open" instruction in my program. There is no error in my program and yes, I have a normally closed stop button wired to I:0/2. I am using an XIC instruction to look at I:0/2. This is perhaps 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. I like Ron Beaufort's explanation the best, an XIC goes and looks for a "1" in the corresponding data box. I don't even like saying the input is "ON" or there is "POWER", because all of these explanations assume things that may not be true.
Now that we've got that out of the way back to our Motor A sample. In fact, here is the above image again just so you don't have to scroll up to see it.
Pressing our 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 we let off of our start button, the top branch will be false but the bottom branch will "seal in" Motor A as long as our 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. I 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.
I 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.
But 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 article on. Click here to view the article but in summary, in the event of a power failure and both motors are running, method A's motor will not turn on when power is resumed. Yet 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. What would you like to learn about next? Comment below and we'll see if we can help.