Five Popular PLC Programming Languages You Need to Know

Posted by Harvie Hill on

PLC programming languages are used to program the automation devices in the industrial field. The device connect through PLCs can perform certain tasks like moving products or sorting them. The 5 most popular PLC Programing languages nowadays are all part of International Electrotechnical Commission Section 61131-3 Standard. IEC Standard is a set of rules that standardize PLC languages.

The PLC programming language can be divided into two section: text-based and graphical.

Five Popular PLC Programming Languages You Need to Know

Text-based Languages:

  • Instruction List (IL)
  • Structured Text (ST)

Graphical Languages:

  • Ladder Logic Diagram (LLD)
  • Sequential Function Charts (SFC)
  • Function Block Diagram (FBD)

The following are the introduction of the 5 programming languages.

1.Instruction List (IL)

Instruction List is a textual based language. Similar to Assembly Language, IL makes use of an important concept of mnemonic codes, including LD (Load), AND, OR, etc.

instruction-list mnemonic codes

 

Example:

LD A (Load A)

AND B (And B)

ST C (Store result in C, i.e. output to C)

In the first line of the program, LD is the operator, A the operand, and the words at the ends of program lines.

LD A is thus the instruction to load A into the memory register. It can then later be called on for further operations. The next line of the program has the Boolean operation AND performed with A and B. The last line has the result stored in C, that is,output to C.

 2.Structured Text (ST)

Structured Text is also a textual based language,which is a high-level language that like C, Pascal and Basic. When you use the ST language, you must write out each line of code.

With the function such as FOR, WHILE, IF, ELSE, ELSEIF AND CASE, ST is a very powerful tool that can execute complex tasks utilizing algorithms and mathematical functions along with repetitive tasks. Separating by semicolons, the code uses statements to change the inputs, outputs or variables.

Example:

TxtState := STATES[StateMachine];

 

CASE StateMachine OF

   1: ClosingValve();

      StateMachine := 2;

   2: OpeningValve();

ELSE

    BadCase();

END_CASE;

Unlike in some other programming languages, there is no fallthrough for the CASE statement: the first matching condition is entered, and after running its statements, the CASE block is left without checking other conditions.

3. Ladder Logic Diagram (LLD)

Ladder Logic Diagram was originally a written method to document the design and construction of relay racks, which used physical devices, such as switches and mechanical relays to control processes. Ladder logic has evolved into a programming language that represents a program by a graphical diagram based on the circuit diagrams of relay logic hardware. Ladder logic is used to develop software for programmable logic controllers (PLCs) used in industrial control applications.

Example:

Example-Ladder-Logic-Diagram

Relay logic diagrams represent the physical interconnection of devices. Each rung would have a unique identifying reference number and the individual wires on that rung would have wire numbers as a derivative of the rung number.

 4. Sequential Function Charts (SFC)

A Sequential Function Chart (SFC) is a series of scripts that are defined in a single location, and then called in sequential order. Additional elements in the chart can determine where the flow of the chart will lead. Charts can loop around indefinitely, or execute a set number of times before ending. Sequential Function Charts are based on a graphical programming language in the IEC 61131-1 standard.

SFCs are used to execute logic in ways that are more convenient to structure than with Python scripts or PLC programming alone. Because of their inherently visual depiction, they help to illuminate logic to users, and facilitate intuitive development and refinement. Charts can be monitored as they run visually, making troubleshooting easier than with scripting alone.

Example:

Sequential Function Chart Architecture Examples

The chart would Start and then move to the first motor. 
The Start Motor 1 action would then run a script to start Motor 1. 
Once the script finishes, the chart then flows to Start Motor 2, and calls a script that would start Motor 2. 
When the second script finishes, the chart flows to the End step, and concludes the chart.

5. Function Block Diagram (FBD)

The Function Block Diagram (FBD) is a graphical language for programmable logic controller design,[1] that can describe the function between input variables and output variables. A function is described as a set of elementary blocks. Input and output variables are connected to blocks by connection lines.

FBD is fundamental for all PLC programmers. It is a great way to implement everything from logic to timers, PID controllers, and even a SCADA system in your solution, etc.

Example

Simple function block diagram

Inputs and outputs of the blocks are wired together with connection lines, or links. Single lines may be used to connect two logical points of the diagram:

  • An input variable and an input of a block
  • An output of a block and an input of another block
  • An output of a block and an output variable