laitimes

Want to learn PLC programming? Let's figure out the 5 PLC-specific languages first!

author:Siege of the Great Lion

PLC currently has 5 standard programming languages, including graphical programming language and textual programming language.

Graphical programming languages include:

梯形图(LD-Ladder Diagram);

功能块图(FBD - Function Block Diagram);

顺序功能图(SFC - Sequential Function Chart)。

Textual programming languages include:

指令表(IL-Instruction List)& 结构化文本(ST-Strutured Text)。

Want to learn PLC programming? Let's figure out the 5 PLC-specific languages first!

The programming language of IEC 1131-3 is a set of international programming language standards for industrial control systems formed by the IEC working group on the basis of reasonable absorption and reference of the programming languages of PLC manufacturers around the world. It is not only suitable for PLC systems, but also for a wider range of industrial control fields, making an important contribution to the global standardization of PLC programming languages.

Relay Ladder (LD)

LD-Ladder Diagram is the first programming language used by PLC, and it is also the most commonly used programming language for PLC.

The ladder programming language is evolved from the schematic diagram of the relay control system, which is consistent with the basic idea of the ladder diagram of the relay control system, but there are certain differences in the use of symbols and expressions.

Want to learn PLC programming? Let's figure out the 5 PLC-specific languages first!

PLCs are designed to be used by electrical technicians on the factory floor, in order to conform to the habit of thinking of relay control circuits.

As the first programming language used in PLC, the ladder diagram retains the style and habit of relay circuit diagrams, and has become the most acceptable and used language for the majority of electrical technicians.

1. Soft relays

Some of the programming elements in the PLC ladder diagram retain the name relay, such as input relays, output relays, internal auxiliary relays, etc., but they are not real physical relays, but some memory cells (soft relays), each of which corresponds to a memory unit of the image register in the PLC memory.

If the memory cell is in the "1" state, it means that the coil of the corresponding soft relay in the ladder diagram is "energized", and its normally open contacts are turned on and the normally closed contacts are disconnected, which is said to be the "1" or "ON" state of the soft relay.

If the memory cell is in the "0" state, the coil and contacts of the corresponding flexible relay are in the opposite state as described above, and the flexible relay is said to be in the "0" or "OFF" state. These "soft relays" are also often referred to as programming elements in use.

2. No-ryu

There is an imaginary "Concept Flow" or "Power Flow" flowing from left to right, which is consistent with the order of logical operations when executing the user program.

Energy flow can only flow from left to right. Using the concept of energy flow can help us better understand and analyze ladder diagrams.

3. Busbar

The vertical common lines on both sides of the ladder are called bus bars.

When analyzing the logical relationship of the ladder diagram, in order to borrow the analysis method of the relay circuit diagram, it can be imagined that there is a DC power supply voltage between the left and right buses (left bus and right bus), and there is an "energy flow" flowing from left to right between the busbars. The right bus bar can be left undrawn.

Want to learn PLC programming? Let's figure out the 5 PLC-specific languages first!

4. Logical solution of ladder diagram

According to the state and logical relationship of each contact in the ladder diagram, the state of the programming element corresponding to each coil in the diagram is calculated, which is called the logical solution of the ladder diagram.

The logical solution in the ladder diagram is carried out in the order from left to right and from top to bottom. The result of the solution can be used immediately by the subsequent logical solution.

The logical solution is based on the value in the input image registers, not on the state of the instantaneous external input contact.

1. Corresponding to the electrical operation schematic diagram, it is intuitive and corresponding;  

2. It is consistent with the original relay logic control technology, and is easy to master and learn for electrical technicians; 

3. The difference with the original relay logic control technology is that the energy flow in the ladder diagram is not the current in the actual sense, and the internal relay is not the actual relay, so when applied, it needs to be treated differently from the relevant concepts of the original relay logic control technology; 

4. There is a one-to-one correspondence with the instruction list programming language, which is convenient for mutual conversion and program inspection.

Function Block Diagram (FBD)

Function Block Diagram (FBD) uses graphic symbols similar to digital logic gate circuits, which is logical intuitive and easy to use, and it has instructions equivalent to electric shock and coil in ladder diagram programming, which can solve a wide range of logic problems.

Want to learn PLC programming? Let's figure out the 5 PLC-specific languages first!

1. Take the functional module as the unit, start from the control function, so that the analysis and understanding of the control scheme becomes easy;

2. The functional module is to describe the function in a graphical way, and its intuitiveness greatly facilitates the programming and configuration of the designer, and has good ease of operation;

3. For the system with large control scale and complex control relationship, because the relationship between control functions can be expressed more clearly, the programming and configuration time can be shortened, and the debugging time can also be reduced.

Sequential Function Diagram (SFC)

Sequential Function Chart (SFC), also known as flowchart or state transition diagram, is a graphical functional description language dedicated to describing industrial sequence control programs, which can be used to program systems with complex structures such as concurrency and selection.

Want to learn PLC programming? Let's figure out the 5 PLC-specific languages first!

1. Take the function as the main line, be clearly organized, and facilitate the understanding and communication of the program operation;  

2. For large-scale programs, it can be designed by division of labor, and a more flexible program structure can be adopted, which can save program design time and debugging time; 

3. It is often used in occasions where the scale of the system is large and the program relationship is more complex;

4. Only when the commands and operations of the active step are executed, the conversion after the active step is scanned, so the scanning time of the whole program is greatly shortened compared with the scanning time of other programs.

Instruction Table

IL-Instruction List programming language is similar to the mnemonic assembly language in the computer, it is the most basic programming language of the programmable controller, the so-called instruction list programming, is to use one or several easy-to-remember characters to represent a certain operation function of the programmable controller.

Want to learn PLC programming? Let's figure out the 5 PLC-specific languages first!

1. The mnemonic is used to represent the operation function, which has the characteristics of easy to remember and easy to master;

2. The mnemonic is used on the keyboard of the programmer, which has the characteristics of easy operation and can be programmed in the absence of a computer; 

3. There is a one-to-one correspondence with the ladder diagram, and its characteristics are basically similar to the ladder diagram language.

Structured Text (ST)

ST-Strutured Text is a high-level text language that can be used to describe the behavior of functions, function blocks, and programs, as well as the behavior of steps, actions, and transitions in a sequential function flowchart.

The structured text language is similar to the PASCAL language on the surface, but it is a programming language developed specifically for industrial control applications, with strong programming capabilities for assigning values to variables, calling back functions and function blocks, creating expressions, writing conditional statements and iterative programs, etc.

Want to learn PLC programming? Let's figure out the 5 PLC-specific languages first!

1. Using high-level language for programming, it can complete more complex control operations;

2. It is necessary to have a certain knowledge of computer advanced programming language and programming skills, and the skills of programmers are required to be high, which cannot be completed by ordinary electrical personnel.

3. Poor performance such as intuitiveness and ease of operation; 

4. It is often used for the implementation of some control functions that are difficult to achieve in other languages such as functional modules.

Note: Not all PLCs support all programming languages (such as function block diagrams, sequential function diagrams, and many low-grade PLCs do not support them), while large PLC control systems generally support these 5 standard programming languages or similar programming languages.

Want to learn PLC programming? Let's figure out the 5 PLC-specific languages first!

There are also some non-standard programming languages that have not been selected for the standard language, but they have been developed for some special applications, and in some cases, they may be better programming languages.

For example, the continuous function diagram CFC of D7-SYS is specially developed for large-scale continuous process control, as long as the CFC function block in the program can be easily realized such as PID controller, counter, locator, ramp function generator and a series of special functions, and no special programming knowledge is required, only need to know how to use graphical processing and standard program blocks, and make simple settings.

Let's talk about the learning method of PLC

1. Learning PLC programming requires strong perseverance and enough patience

Everyone has their own strengths. Some people see programming as a long and boring job; Some people see programming as a fun mind game. If you are the former, it is highly recommended that you stay away from this job.

After all, programming is a challenge to people's perseverance and patience, and programming requires countless trials and errors, debugging-modifying-debugging-modifying... After countless failures, you will get a great sense of accomplishment when you see the PLC running in an orderly manner according to your control requirements, and it is like breaking through a game, and that feeling is the same.

2. Learning PLC programming requires the confidence to dare to practice

Many beginners are afraid to do it out of fear of damaging the equipment. In fact, there is no reason for these fears, as long as you read the manual carefully and follow the standard specifications to wiring the actual operation, there will be no problems.

Don't worry about what problems will be with the program you wrote, it will affect the normal operation of the PLC, and whether there is a problem with the program can only be found when the PLC is run. Therefore, we must have the confidence to dare to practice, and bold practice is the only way to program PLC.

3. Programming requires careful logical thinking

Programming itself is a logical thought process.

The original PLC was used to replace the relay logic circuit, so it inherited the way the relay circuit was described with the contact as the trigger condition.

In the PLC, the relay contacts are replaced by virtual contacts, and the logical relationship expressed by the relay circuit is still completely retained. Therefore, it is necessary to straighten out the logical relationship between objects and to have careful logical thinking.

4. Develop good programming habits

Everyone will have different habits and characteristics of programming, and they cannot be forced to be consistent. But there are some good habits that most people should follow.

1. Straighten out the logical relationship and timing relationship, and compile the block diagram;

2. Reasonable allocation of main programs, sub-programs and interrupt programs;

3. Allocate registers reasonably and compile a register symbol table.

Many of the PLC's operations are directly aimed at registers, and if there is an unreasonable overlap of register addresses in the program, it may cause program errors.

Compiling a list of register symbols not only avoids the above problems, but also makes the program more readable.

PLC provides a wealth of instructions, modules, beginners should try to use simple instructions to achieve the purpose of programming, which will help you understand those more complex instructions, with a certain experience, you should consider mastering the application of complex instructions, as well as the optimization of the program.

5. Have a certain basic knowledge of programming

It is important to have a certain basic knowledge of programming, as well as to understand the theory of PLC programming.

Without theoretical preparation or guidance in this area, simple problems are easy to deal with, but complex ones are not easy to handle, not only do they have no way to start, but they also spend a lot of time and energy, and it is also difficult to compile high-quality programs, which often results with half the effort.

Any theory is only a summary of experience, and in the final analysis, it also comes from practice.

Read on