Types of PLC Programing Language

The plc programming language specified in IEC 61131-3 includes instruction lists and structured text (ST) as text languages, as well as graphics such as ladder diagrams, function block diagrams (FBD), continuous function diagrams (CFC), and sequential function diagrams (SFC). Language.

1. Instruction List (IL)

The instruction list language is the most basic language for PLC programming. However, the program compiled with it is less readable.

2. Structured Text Language (ST)

The ST language is similar to the BASIC language, the PASCAL language, or the C language. It does not have a single instruction, only a complete set of statements that consist of a set of instructions. Specific statements include assignment statements, conditional statements, selection statements, loop statements, and other statements (EXIT statements, RETURN statements, function block call statements, etc.).



The functions and operators provided by the ST language of different brands of PLCs may be slightly different.

The ST language function is stronger than the graphic language, but it is not as intuitive as the graphic language, and it is not widely used at present. For example, Omron plc can only be used in programs that have self-programming blocks.

Also for the ST language, the details of each PLC manufacturer are not exactly the same.

3. Ladder diagram (LD)

The ladder diagram is from the United States and is a ladder-based graphical symbol Boolean language.

The ladder language corresponds to the electrical schematic and is consistent with the original relay logic control technology. Unlike the original relay logic control technology, the power flow in the ladder diagram is not the actual meaning of the current, and the internal relay is not the actual relay.

The left busbar of the ladder diagram is like the power cable of the electrical schematic diagram. It is generally not directly connected to the output class command (equivalent to the load of the electrical schematic). There must always be some commands in the middle that can establish the logic condition (equivalent to the electrical schematic). control element). But some PLCs also allow this.




4. Function Block Diagram (FBD)

The FBD language (a graphical language corresponding to logic circuits) is very similar to the signal flow diagram in an electronic circuit diagram. FBD is widely used for process control.

The FBD language describes the control functions in units of functional modules. In particular, it is more convenient to control a system with a larger scale and a more complex control relationship.



5. Continuous Function Chart (CFC)

Similar to FBD, CFC also uses various functional blocks as needed. The difference is that it is more flexible, the position of the block can be placed arbitrarily, especially when there is signal feedback, it is more convenient to draw.

In order to have a clear order of execution of the block, the upper right corner of each block is labeled with a sequence number. However, in actual expression, this label can also be selected and not displayed.



6. Sequential Function Chart (SFC)

The SFC language is characterized by describing the sequence of control programs. It graphically describes all the phenomena of the system in a simple and clear way, and can analyze and model abnormal phenomena such as deadlock and insecurity that exist in the system. Programming on this basis. Therefore, it has been widely used.

In fact, the SFC language is just a graphical way of organizing programs. Its actual use should be matched with other languages, otherwise its function will not be realized. So, strictly speaking, it is not a complete programming language.

1) Composition

Step

It is represented by a box, which has three types: initial step, active step, and inactive (rest) step. Whether a step is an active step, that is, whether it is active or not depends on the previous step and its corresponding transition.

Action

An action is a component of a step. A step contains one or more actions, represented by a rectangular box attached to the step. The program code in each action can be written in any language of IEC such as ST, FBD, LD or IL. Each action also has a qualifier that determines when the action is executed or terminated when the step is activated.

Directed connection

Connect the steps from top to bottom and from left to right. You can also use the arrow to make non-up, left and right step connections.

Transfer

Vertical short lines on the directed line. The logical conditions associated with the transfer are marked with text, Boolean algebraic expressions, and graphical symbols next to the transition line.

2) SFC transfer rules

The transfer of steps refers to the transition of the active and backward activation states of the connected wires.

The rules for the transfer between steps are:

The transition logic condition between 1 step is true;

2 The first step of the transfer step is active.

If these two conditions are not met, they will not be transferred.

In order to initiate the execution of a sequential function flow chart program, an initial step is always specified, which is marked S0, which is the step that was activated when the program was started. With this initial step, the activation state of the step in the flowchart will be gradually converted as the corresponding transition logic condition is met, until the last step is activated, or the loop is continuously looped according to the specified route.

3) The main form of SFC

According to the structure, it can be divided into the following forms: single sequence control, parallel sequence control, branch structure sequence, transfer sequence and so on.

The figure below shows a program written in the SFC language.


Top