Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the ladder diagram method of PLC programming?

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "what is the ladder diagram method of PLC programming". In the daily operation, I believe that many people have doubts about what the ladder diagram method of PLC programming is. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "what is the ladder diagram method of PLC programming?" Next, please follow the editor to study!

1. Set / reset instruction

The set/reset instruction is called latch/unlatch in AB terminology and its purpose is to allow you to latch without using a contact. So you can set the output using only one instruction in the trapezoidal logic, and then reset the coil in another place.

The symbols for set or latch instructions are as follows:

The symbols for reset or unlatch instructions are as follows:

The set/reset instruction contains two coils, but controls the same address bit. When you give a pulse to the set coil, the address bit will be set. The difference from the ordinary coil is that the set coil will be held until it is reset using the set coil.

When you are building a large PLC program that contains thousands of points, or when connecting to a SCADA system, make sure you know where to set and where to reset.

1.1 priority of setting or reset

Using two coils to implement the set/reset function presents a new problem:

Which coil has the highest priority?

What is the final state of the coil when the condition of both set and reset is true?

The last one executed by PLC, the result is which one.

If you set / set the coil in a network and then reset / reset in the network below, the coil will reset. Remember, PLC executes trapezoidal logic instructions from top to bottom.

1.2 set / reset function block

Another way to implement set/reset functionality is to use function blocks, which can be used not only in trapezoidal logic, but also in function block diagrams and structured text code.

SR function block

The first function block is called set first Monostable module, or SR or set/reset function block. Set has the highest priority, which means that when the condition of set and reset is both true, the output is set.

The symbol of the SR function block is as follows:

It has two inputs: one for setting / set and one for resetting / reset. There is an output on the other side.

RS function block

Another function block is called RS or reset priority Monostable module. Basically it works the same way as SR, except that reset has the highest priority:

2. Ladder diagram logic actual combat

We've learned the basics of ladder diagrams and common instructions, and it's time to start implementing some real tasks.

Because to be a good PLC ladder diagram programmer, it is not enough to know the instructions, you must be able to use ladder logic to solve practical problems. Now let's take a look at how to use ladder diagrams to develop PLC programs to solve real-world problems.

When I use trapezoidal logic to solve problems, one of the things I like to think about is to think from a conditional point of view, which is usually called combinatorial logic, and you may have heard of it, or at least know about logic gates-- and, or, no, and so on.

The first example I'm going to give is the implementation of interlocking logic. Because you can achieve interlocking with simple instructions.

Interlocking is used in many PLC programs because it avoids simultaneous activation of incompatible situations. A classic case is the control of star/delta motor. If you are using PLC to control a star/delta motor, you must ensure that when the output of the delta relay is activated, the output of the star relay must not be activated.

2.1 example of start/stop logic

Let's take a look at an example of interlock between two motors, which requires that only one motor can run at a time. Each motor has a start button and a stop button to start and stop the motor, respectively.

The start and stop of the motor can be achieved using the set/reset instructions described earlier.

The first condition for the start and stop buttons of each motor is, of course, the condition for the start or stop of the motor. Since the motor can be in one of two states, we need to check these two states:

If the start button is pressed and AND does not press the stop button, then activate the motor

If the stop button is pressed, then stop the motor

Since the motor can only be in these two states, we only need to check the conditions under which the motor is activated. Because if these conditions are not met, then the motor will not be activated.

We can also add locking features:

If the start button is pressed, the OR motor is running and AND does not press the stop button, then activate the motor.

It is important to note that we have broken down the function into logical implementations:

As you can see, these logical relationships can be easily implemented using trapezoidal logic.

2.2 use ladder diagrams to implement / AND, or / OR logic

The logical relationship between the start button and the motor state is or / OR. When either the start button or the motor state is true, the motor will be activated.

In trapezoidal logic, or / OR logic is implemented using two parallel instructions:

Or-gate-ladder-logic-1.png

On the other hand, to keep the motor active, you cannot press the stop button. But the relationship between the start button and the motor state, and the stop button is / AND, because to keep the motor active, you need to meet the start conditions and do not press the stop button.

It is implemented in series with / AND logic using instructions:

One of the advantages of ladder logic is that you can implement it graphically. Because if you look from left to right along the line in each network, you can understand the logical relationship between instructions.

Or / OR logic always has two options, so there will be two lines, and / AND has only one option, so there is only one line.

2.3Using ladder diagrams to implement non / NOT logic

There is also a logical relationship that is not introduced in the above example. To keep the motor active, you cannot press the stop button, for which we need to use non / NOT logic.

Non / NOT logic can be implemented using counter contacts:

Here we use a regular closed relay to represent the stop button, so the logic is flipped:

2.4 using ladder diagram to realize interlocking logic

Of course, this part of the trapezoidal logic is just the control logic of a motor. Two motors are included in our example, so the complete ladder diagram logic looks like this:

Now we at least need to realize the interlock of two motors, which can also be regarded as logic.

In fact, if you think of interlocking as logic, it's easy to implement it, because motor interlocking requires only one additional condition: another motor is in a stop state. So if the motor "wants to be activated, the motor" cannot be activated, and vice versa:

If the "motor start button OR" is pressed while the motor is running, AND does not press the "motor stop button" AND "motor is not running, then activate" motor.

If the "motor start button OR" is pressed while the motor is running, AND does not press the "motor stop button" AND "motor is not running, then activate" motor.

You only need to add a reverse relay to the ladder diagram:

This simple example shows how to decompose a real problem into logical steps, and then use a ladder diagram to develop a PLC program to solve the problem. But these logical relationships are not only used for conventional open-close instructions, they can also be used for many different PLC instructions, such as counters and timers.

2.5 ladder diagram logic implementation exercise: implementation of interlock

The core of this tutorial is that you can learn how to implement trapezoidal logic. Now is the time to do the exercise:

Functional requirements

For the start / stop control of three motors, at most two motors can run at the same time. For example, if the motor and the motor are running, then the motor cannot be started.

Input

Output

I hope you enjoy this exercise and learn something from it.

This exercise introduces another question, which will lead us to the next trapezoidal logic instruction. The problem is not the trapezoidal logic itself, but the button connected to the input.

3. The signal triggers the instruction along the single.

Usually you want the operator to just press the start button or the stop button-very briefly. But the reality is that the operator will hold down the button for a long time, another case is that the button is stuck after pressing, this common hardware failure will also affect the operation of the PLC program.

If the stop button of a motor is stuck, you can no longer start the motor. In fact, this is a common problem when you use transient buttons on PLC.

But don't worry, we have a way to solve this problem. Fortunately, there are ready-made trapezoidal logic instructions for this problem, single trigger instructions.

3.1 rising edge detection

Now it's time to learn new instructions. I will introduce the first type of single trigger instruction, the rising edge detection instruction, R_TRIG, which on some platforms, such as AB, is called OSR-rising edge single trigger.

As the name suggests, these trapezoidal logic instructions check the rising edge of a digital signal, which means that they will only check for changes from 0 to 1 in the digital signal.

This is an illustration of the rising edge of a digital signal:

The length of the signal is irrelevant because we only check for changes in the state of the signal. Therefore, these trapezoidal logic instructions used to detect the rising edge perfectly match the requirements of the start button and the stop button.

Rising edge contacts and coils

The rising edge detection relay looks similar to the normally open contact, but in fact it uses the same symbol, but with an extra P in the middle:

The function of the rising edge contact is also different, because this instruction is not to check the status of a point, but to check for a change in the state of that point, or rather a positive change from 0 to 1.

Now, because this instruction only looks at the change in the state of the point, even if the button is stuck, it will not be continuously activated in the subsequent scanning cycle because the state no longer changes after it is stuck. This is why these instructions are called single trigger instructions.

As you can see, this instruction only gives a pulse when a positive change occurs.

Finally, you will also see the rising edge detection coil:

It has the same function as the rising edge contact, except that it is a coil.

R_TRIG function block

You can also use a function block to implement rising edge detection, which is called R_TRIG, a standard PLC instruction.

3.2 falling edge detection

Like the rising edge, there are instructions to detect the falling edge, or F_TRIG. AB calls it a falling edge single trigger or OSF instruction.

Similarly, the drop along the single trigger checks for a change from 1 to 0 in the signal state, as shown in the following figure:

Falling edge detection is very useful, for example, to detect the shutdown of a device.

Falling edge contacts and coils

The falling edge instruction includes the falling edge contact and the falling line loop. They are called single trigger instructions because they are activated only when the state is transitioned from 1 to 0.

Depending on where you want to detect the falling edge in the trapezoidal logic, you can use a contact or coil:

A typical application scenario of the drop edge command is that you need to detect the stop of one device in order to start another device. For example, a heating device and two fans, when a heating device is running, you need to run a fan at the same time, but when the heating device is turned off, you need to run the second fan immediately to accelerate cooling.

You can try to solve this problem in trapezoidal Logic exercise 3 to see if you need to use the descending edge instruction.

F_TRIG function block

You can also use a function block to implement falling edge detection, which is called F_TRIG, a standard PLC instruction.

I've learned a lot. It's just that it's time to practice. In my opinion, the best way to learn is to solve problems. In these exercises you will use the rising edge and falling edge detection instructions. But first, keep in mind that a single trigger instruction is only valid for one scan cycle. If you want to use it to start something that takes a long time to run, you need to lock or use the set/reset instruction. .

3.3 ladder diagram logic implementation exercise: rising edge detection

Functional requirements

Use a start button and a stop button to control the start and stop of the motor, but be sure to start or stop the motor only on the rising edge.

Input

Output

3.4 ladder diagram logic implementation exercise: falling edge detection

Functional requirements

Use a start and stop button to control a heating device and a fan. When the heating device is turned off, start the second fan. When the heating device and the first fan are turned on, turn off the second fan immediately.

Input

Output

At this point, the study of "what is the ladder diagram method of PLC programming" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report