Programming a plc pdf




















PLC programming language refers to the set of semantics or methods that allow the user to communicate information to the PLC. Textural programming languages are those in the form of text and consists of commands that the user must all be familiar with in order to create a program.

If you have a background in C programming, you will closely see its resemblance. The structured text language are written as a series of statements terminated by semicolons like in C. These statements are defined by the language libraries and makes it easier to set input-output relationships in the program.

The example above directly shows the relationship between the variables for the input and the output. For example, in the structured text above, all variables within the parentheses will be executed first. Instruction lists are also considered a way of entering ladder programs, except by using text. It gives a series of instructions for each new line and uses mnemonics for each one.

Since different manufacturers use different mnemonics, I will only give the IEC as an example. PLC programming languages that are visual are also high-level languages. Sequential Function charts, on the other hand, are just that—charts that represent each function in a PLC control system in a sequential fashion. Another reason is that the PLC programmers usually prefer to define the actions in terms of contacts, which again was the most commonly used control system before the PLC.

Since this is the most commonly used PLC programming language, this is the one that you will learn in this mini-course. The only difference is that because the PLC was very flexible in terms of the Input and Output Devices, the symbols for the electrical devices are now exempted from the actual program. No need to memorize all the standard symbols for each separate device. The ladder logic diagram consists of two fundamental parts, which you can see as the vertical and the horizontal lines.

They are called, respectively, the rails and the rungs. Now, you may have noticed in the ladder logic diagram example above, there are multiple inputs in the same rung. The number on the left represents a new rung. In the example above, there are 4 rungs present. It may seem for total beginners that there should be 7 rungs, but each parallel connection only shows an OR relationship between the two inputs.

Back to the example, the two vertical rails represent the 24 Vdc source and the other one the 0 Vdc terminal. They are power rails. What this means is that for an output element more on that later to become powered up, you have to connect the two rails together by finding a way to connect them via your inputs.

To scan the program for continuity of rungs, the PLC uses a top to bottom, left to right sequence, thus checking continuity between the two rails for each scan. In PLC Programming there are some fundamental notations that you must remember to create programs, and they are very simple. In fact, you have already seen them in the example above but this time, you are going to learn what those actually mean.

Two vertical bars represent an input device. They are classified that way because the Relay Logic has used the same principle in the Relay Logic Diagrams. In fact, this was inspired by electromechanical relays because they, too, can also be normally open or normally closed. Normally open inputs are the ones that have the two vertical lines separated by a space in between. Normally open inputs, like normally open relays, do not by default create a connection between the two rails when connected.

When activated, only then it will create the connection. These inputs could be any input device or sensor that is used to conditionally activate an output device.

Normally closed inputs are the ones that have the two vertical lines with a forward slash that connects the two opposite ends. Shown above is the notation for an output device in a PLC ladder logic diagram. PLCs have solved the problem brought by relays, and it was thanks to the software-based relays that were designed for the PLC.

These relays now only rely on the memory component of the PLC so instead of actually using relays to create a connection point, the memory of the PLC now only stores the states of the supposed relays.

Internal relays are elements that hold data to serve as relays for the system. This is what makes the PLC more cost-effective than the conventional relay systems that were used before. For example, using an internal relay in conjunction with a push button allows you to turn on a solenoid valve in one rung and a motor in another rung using the same push button.

When the PLC is suddenly turned off, whether due to a power outage or some connection breaks, the states of the internal relays become erased automatically. Because of this, when you start the PLC after that scenario, the states of the internal relay will go back to the initial stage of the program rather than the LAST state that it had before the power outage happened. This is where battery backed relays come into play.

They retain their state of activation even when the power supply of the PLC is entirely off. Hence, they are also called retentive coils. Internal relays only retain their state if the input devices that are placed to activate them are also retaining their activation states.

For set and reset relays, however, you can actually retain their state indefinitely and then remove the state using another condition from an input device. The internal relays were designed for a specific purpose which is obviously to eliminate the need of external relays. This is desirable because not only you would not worry anymore about a relay getting some wear and tear, but also you would not have to worry about spending money on them. In designing control systems, there are times when you would want more than one condition to turn something ON or OFF.

In this situation, using the input device notation over and over again would be impractical and messy as a ladder logic program. The rung would have too many things on it!

Thus, the program above shows that there are two conditions that are represented by an internal relay EACH. In practical applications, sometimes an output must be held ON for an indefinite amount of time until power is cut.

Input devices are usually momentary in nature, hence, for that scenario to happen, Latching programs are required to be set up in the PLC programming software. So far, we have talked about retaining the states of relays and actually doing it even without power supplied to the PLC. Now, this type of operation is used when you want just an output pulse that does not retain its state all throughout the program.

This function is termed as one-shot. One shot operation is momentary, hence pushing the trigger button will only cause an impulse to the output device. Master inputs are used when you want the whole program to be dependent on a Master Control condition. It does not matter if the Slave START buttons were pushed over and over again, because the system will not start without the Master ON button being in an energized state.

The AND condition is basically just two inputs in series with each other. Because the inputs are in series, the two inputs must BOTH have continuity in order for the output to turn on. The OR condition is a parallel connection between the two inputs.

Because the inputs are in parallel to each other, ANY of them may create continuity between the two power rails thus turning the output ON.

Negating inputs is as simple as turning a Normally Open input to a Normally Closed one. Normally Open inputs are inverted. The XOR condition has a different story than the rest of the logical conditions. If you look at the Boolean equation for the XOR condition:. XNOR is rarely used as a logical statement, but it is actually best applied when simplifying logical expressions that have a negated output for XOR.

The safest way is to apply it to the output. In applying the PLC programming skills that you have learned throughout this mini programming course, make sure that you familiarize yourself with the different safety techniques that are most commonly used in control systems! It does not connect to an output card. Internal coils are used to store information.

An internal coil is labeled COIL in our example. When used with a hardwired input, this instruction is "true" until there is a voltage applied to the input. If it is used as an internal coil, it will toggle the instructions associated with it. That is, it will close a normally open instruction and open a normally closed instruction. It requires the use of its "timer finished" bit, like a time delay relay uses its contact.

It could be used to keep track of machine cycles, count parts, etc. It can be programmed with a preset value that triggers another event when the count is reached. If you press a pushbutton switch that is wired to an input, then the bit is said to be true.

Also, if the logic in a rung turns on the output of the rung, then the rung is said to be true. For example, if you wanted to turn on a light with a momentary pushbutton, you would wire it like the circuit below.

When you press PB1, the pilot light PL1 lights up. Now let's do the same thing in a PLC. Each PLC manufacturer gives you the details of wiring their particular modules. Therefore, the PL1 output is off. It will stay on only as long as you hold the button in. Just like electrical current has to flow through the switch to turn on the light in the hardwired circuit, the logic has to "flow" through the normally open instruction which is closed when you press the switch of INPUT1 to energize the output that turns on PL1.

The programming terminal display will look something like this as you hold in PB1. Suppose you want to delay running a motor for 2 seconds after you turn on a switch. You can use the input from the switch to run a timer. Program the timer for the duration you want and then use the "timer finished" bit to turn on your motor.

In this instance, we have configured an "on delay" timing sequence. Note that there is no "off delay" here. As soon as the start switch is released, the "timer finished" bit will drop out and the motor will stop.

With a little creativity, you can combine timers to provide any timing function you need. Most PLCs are programmed via a Windows based terminal. Editing, deleting or adding to the ladder logic is usually pretty straightforward. You use the arrow keys or the mouse to add instructions, change addresses or comments, etc. These terminals will usually have the capability of programming online or offline. This requires great care and a full understanding of what will happen when you make the change.

Scan Time One critical difference between a PLC program and the equivalent electrical circuit is the issue of scanning. Then, it ignores what is happening electrically at the inputs. The PLC will use the information in the temporary buffer to execute the logic in the program. It will solve the logic from top to bottom, determining the truth of each rung, and turn on or turn off the appropriate addresses in the temporary buffer. When it reaches the last rung in the program, the PLC will use the data in the temporary buffer to turn on or turn off the corresponding outputs.

The scan cycle is complete, and the PLC will once again look at the inputs. The amount of time this takes is called scan time, and is measured in milliseconds.

Stated more simply, the PLC reads the inputs, performs the logic and adjusts the outputs as needed. The inputs are updated during the program scan.

In high-speed applications, such as bottling or pharmaceutical lines, this can cause problems. The best way to learn a programming language is to look at a real world example. However, before you can do any programming, you must have a clear understanding of how the machine works. The entire process needs to be automatic. The mechanical and electrical engineers bring you an isometric drawing like the one shown here.

The main conveyor will transport the part into the machine where the part will meet a pneumatically actuated stop gate. At that time, another pneumatic cylinder will actuate a clamp that will push the part back against the conveyor wall. This will hold the part in place during the drilling process.

Photocells will verify that the part is in position; the spindle will lower and proceed to drill a hole in the part. The cycle then repeats itself for each part that comes down the line.

Sequence of Operation Here is a more detailed explanation of the drilling process: When the machine starts, the stop gate lowers and the part is moved into position by the main conveyor. Optical sensors photoeyes determine when the part is in place. When the part is positioned correctly, a clamp extends to hold the part in place.

A sensor in the drill press spindle tells the PLC when the spindle has reached the end of its travel. After the hole is drilled, the spindle retracts, the clamp retracts, the stop gate is lifted and the part is carried out of the machine by the main conveyor. Though the device name, such as PB1, would not show up on the actual station, it is a good idea to show them on your drawing. Do not skip this crucial step. The text in the fixed font is basically the information that you would see if you were looking at the monitor of the computer or a printout.

In actual practice, the fonts used in PLC software vary widely. For the purposes of this book, we want to easily differentiate the program logic from our explanations of the logic. For purposes of this manual, I have placed additional explanations between rungs. Use a title to name the program and include any general information. This type of bit is what we call an internal coil. It has no hardwired connection to the outside world.

If the emergency stop is clear, and the machine guard is in place, and there is no system fault the operator may press the start button to set the latch. Most of the time, the order of the bits in a rung doesn't matter. We could have rearranged any of the bits in this rung, though we would still have to put the latch around the Start pushbutton. The PLC wouldn't care and the output coil would still respond the same.

However, to make the rung easier to read, I try to place bits from left to right in order of importance. If the E-Stop is not cleared, then nothing else should matter anyway.

Having the safety guard in place is more important than a system fault. Now, if those requirements have been met, we can press the start button.

And we don't care about the stop button until we have pushed the start button. Note the instruction used for the input of PB3, the Stop System bit. It may seem backwards at first, since a hard-wired circuit would use the normally closed contacts of the switch. The E-Stop and the guard limit switch are called "safety interlocks. Use additional contacts from the switches and wire them to inputs of the PLC so that it knows the machine is to be stopped, or has stopped.

It is very important to label the bits properly. Arrange the verbs and nouns correctly. If you do, the rung will read like a sentence. There are some simple rules that I always follow when I am writing a description for a bit: - Descriptions for bits portray an action. We can then place just that bit in the rung that controls the spindle motor and know that we have met all the criteria to allow the spindle motor to run.

The idea is to turn on all the pilot lights for a couple of seconds so you can verify that all the lights work. This feature is very handy when you are troubleshooting a machine. When the Emergency stop is first cleared, Timer 0 is started. The result is that all the pilot lights will turn on for two seconds after the E-Stop is cleared.

This bit is then used throughout the program. You want to enable certain machine functions in Auto Mode, and disable some in Manual Mode, and vice versa.



0コメント

  • 1000 / 1000