![]() ![]() ![]() For instance, with your Sandblasting Output (O 0 above), it will be on when the start button is pressed, but the fill level is okay and there are no alarms and the stop button hasn't been pressed. I examine each Output and determine ALL of the conditions that would turn on the Output, then code that for each one. I usually work my way backward from Outputs to Inputs. ![]() It's fundamentally different from regular computer programming and the techniques can be a bit difficult to grasp until you get into the right mindset. The issue here is that you have to wrap your mind around PLC Ladder Logic. This is just the basic logic that would need to be fleshed out extensively with other operational details. What happens with this logic is the following:ġ) Start button is pressed to start sandblasting.Ģ) Sandblasting will proceed as long as sand level is not low.ģ) If sand level goes low, begin filling while sandblasting is paused.Ĥ) When sand level is full, resume sandblasting.ĥ) Stop button or alarm stops the sandblasting operation. "Done Filling Sensor" is whatever means you have of detecting when to stop filling. sensor to detect the level is low and may or may not be latched in some way. momentary contact switch (they are usually N.C., but I used N.O. "Machine Ready" is the summation of any checks you might need to do before the machine is ready to operate. There are many ways to approach the logic, but here is generally the way I would handle something like this: It's impossible to do this properly without knowing the details of what your hardware is (Normally Open, Normally Closed, Momentary contact, etc). You're welcome to ask additional questions. Break your logic up into the smallest possible pieces and place the pieces into separate rungs. Here's an example of many of the above problems in a single rung:įrankly, I have no idea how this will execute (without pulling up the STL), but I'm certain it will NOT do what you're expecting it to. Don't try to stuff too much logic into a single rung - there's no need to conserve ladder rungs. It's good practice to separate HMI calls from the other logic. I find that code in the same rung following an HMI call sometimes does not get executed. In your case the subroutines are mostly Reset coils, so the danger is alleviated, but it leads me to believe you're not understanding the purpose of Set and Reset coils and the difference between them and Direct coils. Conditional calls of subroutines can be dangerous and I recommend avoiding them whenever possible. Placing timer coils and contacts in the same rung, in the way that you're doing, may not work the way you expect. Never place more than one line of code in a single ladder rung. HMI calls need to be gated by a transition contact (i.e. I don't have time right now to go over your program in detail, but a few items were immediately clear: Looping within the scan risks triggering the watchdog. Remember that PLCs are already looping continuously and there is a watchdog timer that is looking for the entire PLC scan to complete within a short period of time. Use subroutines, as needed, to break your logic up into manageable pieces. Just write your logic working left to right and top to bottom. In over 10 years of ladder programming, I've never used that command once. Ladder logic is not like other programming languages you may be familiar with. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |