🚧 Under construction — VoTechWorks is being built. A free tech program — complimentary, as our commitment to get America working.
voTechWorksGrade 13 · a vocational technology learning center, by urbanicity
newSchoolWorks.com › VoTechWorks › Manufacturing & Marine › Robotics / Mechatronics › Programmable Logic Controllers for Mechatronics › Lesson 7
MFG-MECH15-02 · Lesson 7 · 14 clock hours · lab

IEC 61131-3 Languages — Function Block Diagram and Structured Text

Objective. Students will write equivalent control logic in function block diagram (FBD) and structured text (ST) to demonstrate that IEC 61131-3 languages produce the same result, and will identify which language is most appropriate for given control tasks.

⚠ Pending professional review

This lesson, its worked examples and its practice questions has not yet been verified by a licensed engineer or certified journey-level tradesperson or by a certification or approval body. It is a study draft and may contain errors. Do not use it as instructions for work on a job site or on live equipment. Always follow your instructor, your supervising professional, and current official references and regulations.

VoTechWorks program approval and accreditation are still in progress. Credentials are issued only by the certifying bodies named in each program, after their own exams.

IEC 61131-3 Languages: Function Block Diagram and Structured Text

IEC 61131-3 is the international standard that defines five PLC programming languages. Because all five languages operate on the same underlying data and produce the same control results, you can choose the language that best fits the task at hand. This lesson focuses on two of those languages: Function Block Diagram (FBD) and Structured Text (ST).

What Is Function Block Diagram (FBD)?

FBD is a graphical language that looks like an electrical schematic turned into a signal-flow diagram. Logic is built by placing function blocks on a canvas and connecting their inputs and outputs with lines called connections. Data flows from left to right: the output pin of one block feeds the input pin of the next.

Common standard function blocks include:

FBD is especially well suited to data-flow problems — analog signal conditioning, PID loop configuration, and motor interlock logic — because the connections make signal paths easy to trace. Engineers who work with block diagrams in instrumentation or process control often find FBD the most intuitive language.

Converting a Seal-In Circuit to FBD

In Lesson 4 you built a seal-in (latching) motor-start circuit in ladder diagram. The same logic in FBD uses a single SR block:

The result is identical hardware behavior: pressing START latches the motor ON; pressing STOP unlatches it. FBD makes the latch relationship visible without drawing rungs.

What Is Structured Text (ST)?

Structured Text is a text-based, high-level language that resembles Pascal or C. Logic is written as statements that the PLC executes line by line within each scan. Key syntax elements include:

A simple ST snippet for the Lesson 5 counter-reject sequence might look like this:

```

IF PartSensor AND NOT Reject_Active THEN

PartCount := PartCount + 1;

END_IF;

IF PartCount >= RejectThreshold THEN

Reject_Active := TRUE;

PartCount := 0;

ELSIF RejectTimer.Q THEN

Reject_Active := FALSE;

END_IF;

```

ST is especially strong for mathematical calculations, scaling, PID algorithms, complex branching logic, and sequential batch recipes where the step-by-step logic reads more clearly as text than as a ladder or diagram.

Choosing the Right Language

| Control Task | Best-Fit Language | Reason |

|---|---|---|

| Motor interlock, relay replacement | Ladder Diagram (LD) | Familiar to electricians; matches relay logic |

| Signal flow, PID, analog processing | FBD | Visual data-flow matches process diagrams |

| Math-heavy, batch recipes, complex branching | Structured Text (ST) | Clean syntax for calculations and conditions |

| Step-by-step process sequences | Sequential Function Chart (SFC) | Steps and transitions map directly to process phases |

| Specialized, legacy bit-manipulation | Instruction List (IL) | Low-level, rarely used in new designs |

Most modern platforms (TIA Portal, Studio 5000) allow you to mix languages in the same project, assigning each program object the language that suits it best.

Safety Before You Program

Before connecting to or modifying a running PLC trainer:

1. Lockout/Tagout (LOTO) per OSHA 29 CFR 1910.147: de-energize the trainer, apply a personal lock, and verify zero energy before any wiring changes.

2. Machine guarding (OSHA 1910.212): confirm all guards are in place before enabling outputs.

3. NFPA 70E: verify absence of voltage with a properly rated meter before touching any terminal. Wear appropriate PPE for the voltage level present.

4. During software download, warn anyone near the trainer that outputs may energize. Never reach into a machine while downloading.

5. Test new programs at reduced speed or with outputs disabled until logic is confirmed correct.

Key terms8

Function Block Diagram (FBD)An IEC 61131-3 graphical PLC language in which logic is built by connecting standard function blocks (AND, OR, SR, timers, counters) with signal-flow lines; data flows left to right.
Structured Text (ST)An IEC 61131-3 text-based PLC language with Pascal-like syntax, using IF-THEN-END_IF, FOR loops, and arithmetic expressions; well suited to math-heavy and complex branching logic.
SR Function BlockA Set-Reset latch block in FBD; the output latches TRUE when the Set input goes TRUE and remains TRUE until the Reset input goes TRUE, implementing the same behavior as a seal-in rung in ladder diagram.
IEC 61131-3The international standard defining five PLC programming languages: Ladder Diagram, Function Block Diagram, Structured Text, Sequential Function Chart, and Instruction List.
IF-THEN-ELSIF-END_IFThe primary conditional branching construct in Structured Text; the PLC evaluates each condition in order and executes the first branch whose condition is TRUE.
Connection (FBD)The line drawn between the output pin of one function block and the input pin of another in FBD; it carries a Boolean or data value from block to block.
Sequential Function Chart (SFC)An IEC 61131-3 graphical language that represents a process as a series of steps and transitions; best suited to step-by-step sequential processes such as batch filling.
Scan CycleThe repeated loop the PLC executes: read inputs, execute program logic, update outputs; all IEC 61131-3 languages execute within this same scan cycle.
In class: FBD conversion: students take the Lesson 4 seal-in ladder diagram and redraw it as a FBD using AND, OR, and SR function blocks in TIA Portal or Studio 5000; download and verify identical hardware behavior. · Structured text exercise: students write an ST program using IF-THEN-ELSIF-END_IF syntax to implement the Lesson 5 counter-reject sequence; compare results to the ladder version and note differences in readability and structure in a written reflection (minimum half page). · Language selection quiz: given five control scenarios (e.g., sequential batch process, motor interlock, PID loop, step-by-step fill sequence), students write a one-sentence justification for the IEC 61131-3 language best suited to each and discuss as a class.
Materials: PLC programming software (TIA Portal or Studio 5000), PLC trainer, language selection quiz sheet, lab log
Check: FBD and ST programs both produce correct hardware operation (instructor verified); written reflection submitted; language quiz scored 80% or better.

Practice check8

Answer each question, then check it. Nothing is recorded; this is your own practice.

Programmable Logic Controllers
1. Which IEC 61131-3 language uses function blocks connected by signal-flow lines to represent logic?
Programmable Logic Controllers
2. A technician wants to replicate a seal-in (latching) motor-start circuit in FBD. Which function block provides the latching behavior?
Programmable Logic Controllers
3. In Structured Text, which syntax structure is used to evaluate multiple conditions in sequence and execute only the first true branch?
Programmable Logic Controllers
4. A control engineer needs to implement a PID loop with analog signal scaling and several mathematical calculations. Which IEC 61131-3 language is most appropriate?
Safety
5. Before downloading a new PLC program to a trainer that controls physical outputs, which action is MOST important to protect nearby personnel?
Programmable Logic Controllers
6. Two programs — one written in FBD and one written in ST — implement the same motor interlock logic and are downloaded to the same PLC. What output behavior should the technician expect?
Programmable Logic Controllers
7. A student is designing a bottling line program with eight distinct steps: fill, cap, label, inspect, divert, accumulate, pack, and palletize. Which IEC 61131-3 language is generally best suited for representing this kind of sequential process?
Safety
8. Which OSHA standard requires de-energizing equipment, applying a personal lock, and verifying zero energy before a technician modifies wiring on a PLC trainer?
Record this lesson on my transcript. Sign in with your key and enrollment email to record lessons (enroll free if you have no key). This page stays open to read and practise.