What are PLC programming languages? (Part-1)

3WV7...6Wko
20 Jan 2024
207

Today I will tell you about the most commonly used PLC programming languages. These languages, which have the algorithmic structure found in many computer programming languages (Java, Python, C, etc.), have emerged for different purposes and needs. Let's briefly summarize the general features and purposes of use of these languages.

Ladder Diagram (LAD)

Perhaps the most common and popular language among PLC languages is Ladder Diagram. The reason why it is so widespread and popular is that the operating logic of machines in automation systems and process automation is created by logical signs. To be more descriptive; If we are making software to perform certain actions when certain conditions occur in a system, the most appropriate language for this would be "Ladder Diagram". Because Ladder Diagram is a language that emerged to facilitate the software and tracking of logic operations by easily diagramming them. As you can see from the picture above, the straight bars ( | | , |/| ) are used as input and the parentheses ( ) at the end are used as output. In order for the outputs to reach the desired position (Set-Reset, 0-1, True-False), the inputs must provide the desired signals (0-1, True-False).

In short, it would be best to use Ladder Diagram for logic operations with PLC. What about mathematical operations? This is where the LD diagram becomes a complete cruelty. So what do we do for mathematical operations? Let's take a look...

Structured Text (ST)


As you can see in the image, ST language is based on the logic of C language. It provides the opportunity to program using the commonly used IF-ELSE, SWITCH CASE, FOR, DO-WHILE structures in C language. Thanks to these commands, conditional operations and circular operations can be performed. Thanks to its structure, arithmetic operations and comparison operations are performed more easily than other programs. Additionally, since it is written in code, the program takes up less space than visual programming languages.
For example;

IF Ix_Motor_Start_Button THEN
Qx_Engine_Start := TRUE ;
END_IF

The "Ix_Motor_Start_Button" input receives its signal from a physical button on the machine. When this button is pressed, a signal goes to the PLC. PLC also checks the signal according to these code lines and sends a signal from the relevant output ("Qx_Motor_Start"), enabling the motor to start via a contactor or a driver.

Function Block Diagram (FBD)

Function block diagram is used for PLC programs defined with graphical block circuits. FBD is defined as a graphical language that displays the flow of signals and data through input blocks. These blocks are reconfigurable software elements.

FBDs are sequences of program instructions that can produce one or more outputs when executed. Therefore, function block diagrams can be shown as in the picture above by writing the functions into the blocks. FBDs may have logic gates or counters, or they may contain functions written entirely by the developer.

As you can see, many languages can be used in PLC programming. You can choose which language to use according to the operation of your system and the needs of the process. However, some misconceptions in the industry have led companies to the idea of writing monolingual code. While some companies advocate writing using only the ST language, some companies advocate writing using LD or other languages. This is completely wrong. In a PLC program, more than one language can be written in the same program as needed. I will explain why better in part 2 of this article. So stay tuned and don't forget to check out my previous articles and leave a comment.

Edit: What are PLC programming languages? (Part-2)

What is Modbus TCP?
What is ProfiBUS/ProfiNET?
What is CanOPEN and CanBUS? (Controller Area Network)
What is PLC? What is its structure? What are its areas of use?
What is SCADA?
What is HMI Panel/Display?
What is EtherCAT?

Get fast shipping, movies & more with Amazon Prime

Start free trial

Enjoy this blog? Subscribe to Kenyali Geralt

22 Comments