All posts
education4 min read

A Practical Guide to IEC 61131-3 Function Block Diagrams

Function Block Diagrams are one of the most widely used PLC programming languages. This guide covers the fundamentals of FBD within the IEC 61131-3 standard and walks through building a simple motor control program.

Sim Assist Team

What Is IEC 61131-3?

IEC 61131-3 is the international standard that defines programming languages for programmable logic controllers. It specifies five languages: Ladder Diagram, Function Block Diagram, Structured Text, Instruction List, and Sequential Function Chart. Each language suits different types of problems, but they all compile to the same underlying execution model, which means you can mix and match them within a single project.

Among these, Function Block Diagram (FBD) has become one of the most popular choices for industrial automation. It provides a visual, dataflow-oriented way to express control logic that maps naturally to how engineers think about signal processing and sequential control.

How Function Block Diagrams Work

An FBD program is composed of blocks connected by wires. Each block has input pins on the left and output pins on the right. Wires carry signals between blocks, forming a directed graph that the PLC runtime evaluates from left to right, top to bottom, on every scan cycle.

There are three categories of elements in FBD:

Standard Function Blocks

These are stateful blocks that maintain internal memory between scan cycles. Common examples include:

  • TON (On-Delay Timer): Starts timing when the input goes high. The output goes high after the preset time elapses. Used for delays, debouncing, and sequencing.
  • TOF (Off-Delay Timer): The output stays high for a preset duration after the input goes low. Useful for keeping a motor running briefly after a stop command.
  • CTU (Up Counter): Increments a count each time the input transitions from low to high. The output goes high when the count reaches the preset value.
  • SR / RS (Set-Reset Flip-Flops): Latching blocks that remember their state. SR is set-dominant; RS is reset-dominant.

Functions

Functions are stateless. They compute an output from their inputs on every scan cycle without retaining any memory. Examples include AND, OR, NOT, ADD, MUL, comparison operators (GT, LT, EQ), and type conversions.

Variables and Literals

Inputs and outputs can be connected to variables (both local and global) or to literal constant values. Variables represent I/O points, internal memory, or parameters.

Building a Motor Start/Stop Circuit with Timer

Let us walk through a practical example: a motor that starts when a pushbutton is pressed, stops when a stop button is pressed, and includes a five-second startup delay before enabling the main output.

Step 1: Define the Variables

You need the following variables:

  • StartButton (BOOL, input): Momentary start pushbutton
  • StopButton (BOOL, input): Momentary stop pushbutton
  • MotorRunning (BOOL, internal): Latched motor state
  • StartupTimer (TON, internal): Five-second delay timer
  • MotorOutput (BOOL, output): Signal to the motor contactor

Step 2: Latch the Motor State

Use an SR flip-flop block. Wire StartButton to the Set input and StopButton to the Reset input. The output, MotorRunning, will go high when the start button is pressed and stay high until the stop button is pressed.

Step 3: Add the Startup Delay

Connect MotorRunning to the input of a TON block with a preset time of five seconds (T#5s). The TON output will go high five seconds after MotorRunning becomes true. If the motor is stopped before five seconds elapse, the timer resets automatically.

Step 4: Drive the Output

Wire the TON output directly to MotorOutput. The motor contactor will only energize after the full startup delay has elapsed.

This four-block program covers latching, timing, and output driving, which are the building blocks of most industrial control sequences.

Why FBD Works Well for PLC Programming

FBD has several practical advantages over text-based PLC languages:

  • Visual signal flow: You can trace the path of a signal from input to output by following the wires. This makes it easier to understand complex logic at a glance.
  • Reusable blocks: Custom function blocks can encapsulate common patterns (e.g., a motor starter with overload detection) and be reused across projects.
  • Accessible to non-programmers: Electrical engineers and technicians who are comfortable with circuit diagrams often find FBD intuitive, even if they have no software development background.
  • Debugging support: Most PLC environments, including Sim Assist, allow you to watch signal values on the wires in real time during simulation or online monitoring.

Getting Started in Sim Assist

The Sim Assist FBD editor provides all standard IEC 61131-3 blocks out of the box, along with the ability to create custom function blocks. You can wire up a program, attach it to a 3D simulation scene, and test it immediately, all in your browser. No installation, no license key, no hardware required.

If you are new to FBD, start with the motor control example above. Once you are comfortable with latches and timers, move on to counters, comparisons, and multi-step sequences. The standard block library covers the vast majority of industrial control patterns.