A PLC is a Programmable Logic Controller used to control different manufacturing processes. In order to perform this functionality, it accepts some input and produces output data. Basically, using the information from the inputs, and by applying a specific logic written by the engineer, it configures the outputs in a desired way.
According to IEC 61131-3 international standard (International Electrotechnical Commission), there are 5 programming languages to choose from when writing PLC control programs, two of which are textual and the other three are graphical:
- Ladder Diagram (LD);
- Structured Text (ST);
- Instruction List (IL);
- Function Block Diagram (FBD);
- Sequential Function Chart (SFC).
Ladder Logic is the most common language used in PLC programming. It was developed to mimic relay logic, that is why the syntax is very simple.
The inputs are applied as normally open or normally closed contacts. Depending on the logic performed on the inputs, specific outputs (also named coils) are activated. There is also a possibility to read the positive or negative edge of a digital signal. Besides contacts and coils there are also some blocks that have functions for working with different types of data.
This language is called Ladder Logic, because the programs represent a ladder which has two vertical rails and a series of horizontal rugs in between.
Structured Text is a high level language, which represents a combination of three programming languages: Basic, Pascal and C. This language gives the possibility to operate with inputs and outputs, using different statements such as for, while, if and case.
It is easy to implement complex algorithms and work with mathematical functions. The disadvantage is that this language is more difficult to debug, in comparison with a graphical language.
Instruction List is a low level language that resembles the assembly language. A program consists of a series of instructions, listed as in an assembly program. There are some common operations, such as addition, division, multiplication and subtraction. There are also operations that make it possible to jump to some label, as well as to call a function.
Instruction List makes the program compact and offers a big processing speed. The downsides of this language are the structure and the syntax. It is difficult to debug a big list of instructions.
Function Block Diagram
The FBD is a graphical programming language. Each function, even an elementary one, is described by a block with inputs and outputs. The logic is performed by different connection lines between inputs and outputs of the blocks.
Sequential Function Chart
Sequential Function Chart is a graphical programming language that is defined as Preparation of function charts for control systems. It is based on GRAFCET.
This language is used when programming a process that can be split into several steps. There are 3 main components of an SFC:
- Steps with defined actions;
- Transitions with defined logic conditions;
- Links between steps and transitions.
The actions and the conditions can be described in any PLC programming language. The SFC is basically a chart that represents an overview of the project, aimed to ease the analysis of the process.
Each of the PLC programming languages aforementioned have their advantages and disadvantages. The question of which one to use depends on the project requirements and engineer’s expertise.