Control Your Programming Language

IEC 61131-3 Is Intended to Create Commonality in the Programming of Industrial Controllers by 'Harmonizing' the Programming Interface

By Joe Feeley, Editor in Chief

Share Print Related RSS

Since this month's article on safety application programming, Build A Safer Machine Block by Block, identifies function block programming as a segment IEC 61131-3, the global standard for industrial control programming, it seems a good time to do a refresh on the make up of the standard.

IEC 61131-3 is intended to create commonality in the programming of industrial controllers by "harmonizing" the programming interface, including the definition of five languages. The languages are Sequential Function Charts (SFC), used to build the internal organization of a program, and four interoperable languages: Instruction List (IL), Ladder Diagram (LD), Function Block Diagram (FBD) and Structured Text (ST). 

Sequential Function Chart is a graphical language that provides users with a diagram representation of program sequences with elements that consist of steps and transitions. Steps consist of a piece of the program that is carried out until a specific condition is satisfied. Since all discrete applications run as a sequence of steps, SFC is a logical way to specify and program the top level of a PLC program.

Many bit bangers consider SFC ideal for representing function block flowcharts and finite-state machines. It can be used for high-level design. Its disadvantage might be that flowcharts look more like programming flowcharts than control flowcharts, and are not intuitive to use for control engineers who lack a programming background.

Instruction List is a low-level text language similar to older assembler languages. Only one operation—such as storing a value in a register—is allowed per line. It has been useful for smaller applications. Able to produce very efficient low-level (firmware) code, IL has backward compatibility with European and Japanese PLC manufacturers. Critics dismiss IL as a very primitive instruction set, pointing out that a PLC implementation requires a lot of lines of code.

Structured Text is a high-level block-structure text language with syntax that looks a bit like Pascal. It can be used to express complex statements with variables that represent a variety of data types, including analog and digital values. Users claim ST is particularly good at expressing mathematical relationships, and those with a programming background like it. Critics chide the language as not having an attractive set of constructs, nor is it well-suited for users who are not familiar with programming languages.

Ladder Diagram uses a standardized set of relay ladder logic (RLL) programming symbols. It's considered powerful for expressing Boolean interlocking conditions, and it offers backward compatibility for American PLC manufacturers. PLC programmers rely on it, since it closely resembles relays and plant wiring. When properly coded, an implementation should be composed of blocks, each of which performs a particular task. Its biggest disadvantage is that after each scan through the ladder, the language forgets its state information. It works well with simple implementations, but it is hard to decipher when used for large applications. 

Function Block Diagram is a graphical language that allows program elements appearing as blocks to be wired together in a fashion similar to an integrated circuit diagram. Function blocks are standard blocks that execute algorithms such as PID loops. It's well-suited for applications that involve the exchange of information or data among control components. 

Used to represent continuous control activity, FBD's are liked by hardware designers because of their graphical resemblance to building blocks for circuit diagrams. However, users say it can be hard to figure out what a block does when it has a large number of wires connected to it. The maintenance engineer, in particular, needs to be skilled at "unlayering" the in/out wires to understand what the block does.

Member companies of PLCopen, the standard's biggest advocate, believe IEC 61131-3 brings structure to the software and eliminates errors early in the development process. They also say that a programmer only has to learn the languages once—independent of the software package—and this increases the reusability potential of code.

Most experienced users surmise that the standard is only as good as the tools used to implement it. Many hardware-independent programming applications still aren't as good as some proprietary, hardware-specific applications, particularly for reporting, database management, and maintenance and development tools. Programming languages written in a non-compliant manner to handle specific platforms arguably can be richer, because they are hardware-specific.

Share Print Reprints Permissions

What are your comments?

You cannot post comments until you have logged in. Login Here.

Comments

No one has commented on this page yet.

RSS feed for comments on this page | RSS feed for all comments