What software languages are used with programmable logic controllers?
What software languages are used with programmable logic controllers?
An important part of using programmable logic controllers (PLCs)
IEC 61131-3 is part three of the international standard for programmable logic controllers. In this section of the standard, the software architecture and valid programming languages of a PLC are laid out.
The standard lists five different languages, three of which are graphical and two of which are text-based. The languages are as follows:
- Ladder diagram
- Function block diagram
- Sequential function chart
- Structured text
- Instruction list (which was deprecated in the third edition of the standard)
Ladder Logic
Ladder diagram, often referred to as ladder logic, is one of the most prominent languages used to program PLCs. I covered this language in a separate article with examples of ladder logic.
Function Block Diagram
Ladder logic helped engineers and technicians used to relay logic accustom themselves to programming a PLC. Despite this, ladder logic programs can become incredibly hard to maintain and modify when the number of rungs becomes too great. Large systems can have multiple subroutines running on a CPU each with hundreds of rungs of ladder logic. An internal bit on rung three could be used further down the ladder on rung one hundred three. This has obvious problems and led to the creation of more modern languages.
Function block diagram, or FBD, is probably the most widespread programming language used in industrial control. It is a graphical language in which system functionality is described via blocks that accept system variables as inputs and generate system variables and control signals as outputs. For example, instead of putting two XIC instructions in series, an AND function block can be used. This can greatly simplify the programming structure and adds an extra level of abstraction when needed. The image below shows an example FDB diagram from Schneider Electric’s website.
An example of a program written in the function block diagram language.
Notice how one of the inputs to the AND block originates at the final output of the system; in cases such as this an FBD diagram can be far easier to read than a collection of ladder-logic rungs In addition to AND and OR blocks, this diagram also uses SR latches, an on-delay timer, and a type conversion instruction.
Function block diagram can often look like a large digital-logic diagram. It’s important to recognize that despite its appearance, function block diagrams always get broken down into a sequential set of instructions executed by the CPU. Digital logic, in contrast, can be either combinational or sequential, and two unrelated logic blocks always run concurrently and can have different clock speeds.
Other PLC Languages
Sequential function chart (SFC), structured text (ST), and instruction list (IL) are less common than FBD, but they are valuable in certain applications and are used in many industrial systems.
SFC
SFC is a graphical language in which a chart is broken down into a series of steps and transitions. The steps perform actions on data and I/O, and the transitions act as conditional statements that control program flow from one step to another. One place where SFCs work best is in batch processing units. In batch control, ingredients are added one by one, and then actions are performed on those ingredients. It’s like following a cooking recipe, with ingredients being agitated, pumped, and reacted rather than mixed, poured, and baked.
ST
The other two languages will look more familiar to those with a programming background. Structured text is a high-level programming language for PLCs, much like C or BASIC. The code is concise and modular, and it supports high levels of abstraction. ST is often used when large amounts of math or data manipulation are needed. Nested if-else blocks, loops, and arrays are often too cumbersome to be programmed graphically.
Instruction List
Instruction list is basically assembly code for PLCs. It uses a simplified instruction set but has familiar commands like load, store, and jump. While IL is incredibly efficient, it has been deprecated by the IEC and is unlikely to be implemented in future PLCs.
What are we missing from this overview of PLC programming languages? Let us know in the comments below and we’ll update this article.
Copyright Statement: The content of this website is intended for personal learning purposes only. If it infringes upon your copyright, please contact us for removal. Email: [email protected]