Jobs off a real project. You write the Structured Text; the engine runs it and grades every step.
These are not quiz questions. Each exercise opens a full editor with the machine drawn beside it, runs your program on the same scan-cycle engine the IDE uses, and checks the outcome against a step-by-step acceptance spec — including the ones where you open a file on the controller, write a line, close it and read it back.
Calculation that any part of the program can call without consequences: scaling a transmitter, clamping a setpoint, converting units. And the wall you hit the moment you need to remember something.
EX.06.02Clamp a Setpoint — Two FunctionsA FUNCTION has no memory, so a second answer needs a second FUNCTION.
after Scale an Analog Input (FUNCTION)
EX.06.03Flow Units — Where FUNCTION StopsConvert units in a FUNCTION; discover the running total cannot live there.
after Clamp a Setpoint — Two Functions
TIER.02 · MEMORY
0/4
Function blocks
One block per device, instantiated per machine: a motor starter used twice, a debounce that owns a timer, an alarm with a proper acknowledge cycle, a runtime meter per drive.
FUNCTION_BLOCK · instances · nested standard FBs
EX.06.04One Motor Block, Two MachinesWrite FB_Motor once, instantiate it twice — a conveyor and a pump that never share state.
after Flow Units — Where FUNCTION Stops
EX.06.05Debounce Block With a TON InsideNest a TON inside your own block so a chattering prox stops inventing bottles.
after One Motor Block, Two Machines
EX.06.06Alarm Block for Three Plant AlarmsOne FB_Alarm, three instances — the standard active / unacked / latched state machine.
after Debounce Block With a TON Inside
EX.06.07Runtime Hours and Service DueA block that banks running hours per machine and calls for service at its own threshold.
after Alarm Block for Three Plant Alarms
TIER.03 · ARCHITECTURE
0/5
Composition
Blocks made of blocks, and loops that drive them: a three-pump duty gang, an array of conveyor zones, a station composed of devices, a batch state machine, a manager that aggregates faults.
ARRAY OF FB · delegation · state machines · managers
EX.06.08Three-Pump Lead / Lag / StandbyOne FB_Pump, three instances, and a duty rotation that spreads the wear evenly.
after Runtime Hours and Service Due
EX.06.09Four Zones, One FOR LoopARRAY[1..4] OF FB_Zone — an accumulation conveyor where adding a zone is a declaration change.
after Three-Pump Lead / Lag / Standby
EX.06.10A Station That Owns Its PartsFB_Station owns two TONs and an R_TRIG, delegates to them, and shows only five pins.
after Four Zones, One FOR Loop
EX.06.11The Batch Sequencer (CASE + Enum)Idle → Filling → Mixing → Draining → Done, with a fault path and an abort. The pattern.
after A Station That Owns Its Parts
EX.06.12Device Manager With First-OutA manager block iterates four device blocks, aggregates the faults, names the first one, and resets them all.
after The Batch Sequencer (CASE + Enum)
TIER.04 · REAL PROJECTS
0/4
The jobs nobody teaches
Opening a file on the controller, appending a production log, reading a recipe back out of a text file, writing a CSV report — and taking somebody else's copy-pasted mess apart without changing what the machine does.
FB_FILEOPEN / PUTS / GETS · CSV · refactoring
EX.06.13Write the Production LogOne line per finished batch on the controller's memory card — and the Execute/Busy handshake that makes it take more than one scan.
after Device Manager With First-Out
EX.06.14Read a Recipe FileRead /recipes/product_a.txt line by line until bEOF, parse the numbers, and drive the machine setpoints with them.
after Write the Production Log
EX.06.15CSV Batch Report + Error PathHeader row on power-up, one CSV row per batch — and when the card is pulled, the log faults while the line keeps running.
after Read a Recipe File
EX.06.16Retrofit: Three Copies, One BlockThe capstone. Inherit fifty lines of copy-pasted jam detection with two copy-paste bugs, and refactor it into one FUNCTION_BLOCK with three instances.
after CSV Batch Report + Error Path
▸ Stuck on a construct?
Every exercise here has a lesson behind it. If a block is not doing what you expect, the lesson that introduces it will show it running scan by scan.