The core difference between an FB (Function Block) and an FC (Function) is one sentence: an FB carries its own memory (instance data); an FC has no memory (it computes and leaves). Choosing wrongly is not a style issue — control logic with state written into an FC tramples itself across calls; pure computation written into an FB sprays instances everywhere. The sections below compare structure, behaviour and selection.
| Aspect | FB (function block) | FC (function) |
|---|---|---|
| Instance data | Yes: each call binds one instance (DB/instance area); state persists across scans | None: no memory; temporaries rebuilt every call |
| Multiple calls | Instances independent, no interference | Same input, same output (the design goal) |
| Internal timers/edges | Fine — state lives in the instance | Risky: timers/edges need externally supplied state or instances trample each other |
| Returning | Writes instance output variables, multiple outputs fine | One return value, or writes a designated output area |
| Typical duty | Motor, valve, axis control — every "equipment object" | Scaling, comparing, checksums — every "pure calculation" |
Why memory matters: a motor's start/stop logic must remember "am I running or stopped?" — that "now" lives in the instance, and two motors means two instances, each remembering its own. Scaling 0~10 V to engineering units needs no memory — input decides output, and an FC is the perfect home.
Write the FB once and create N instances at the calls: a pump-control FB with three instances serves three pumps — same interface, isolated state. That is the FB's core value: logic reuse through instance isolation. Two traps: ① timers and edge detectors inside the FB must use instance-owned resources (TIA's IEC timer instances / multi-instance capability) — three pumps sharing one global timer is chaos; ② instance-data retention is set per need (run-hours retained, current state not).
An FC has no memory, so hold it to the pure-function standard: read only its input parameters, write only its return/designated outputs, touch no global variables, no timing/edges/accumulation inside. A pure FC is safe to call anywhere — loops, multiple sites, across tasks — because it depends on and changes no history. An FC quietly writing globals is the breach that breaks everything: call order changes the result and nothing explains it.
| Question | Answer decides |
|---|---|
| Does the logic need to remember last time? | Yes → FB; no → FC |
| Does one logic serve several objects? | Yes → FB with instances; no → next row |
| Is it pure computation (same in, same out)? | Yes → FC; stateful → FB |
| Internal timers/edges/accumulators needed? | Yes → FB (instance resources); no → FC |
The quick rhyme: "equipment gets an FB, formulas get an FC". For mixed needs like "scaling with a filter inside", split into two layers: a filter FB (stateful) + a scaling FC (pure) — never smuggle state into an FC pretending it has none.
| Symptom | Cause | Fix |
|---|---|---|
| Two pumps interfere with each other | Control logic as an FC with global state | Rebuild as an FB with instances |
| FC result varies with call order | The FC writes global variables | Make it pure; move state outside |
| FB timers pollute each other | Instances share a global timer number | Timers as instance resources |
| "No instance" error calling an FB | Call without a bound instance | Bind the instance DB per the platform |
| Pure maths hoarding instances | Should-have-been FC written as FB | Refactor to FC |
① FB names carry object semantics (FB_Motor, FB_Valve, FB_Axis), FC names carry action semantics (FC_Scale, FC_CheckSum); ② the interface area (in/out/in-out) doubles as the object's attributes in an FB — fix it in the team template; ③ library FBs/FCs live in the company's standard library project, referenced unchanged; changes go through a library version upgrade; ④ every FB's header comment states purpose, usage limits and version.
The FB/FC split is the stateful/stateless divide: equipment is a persisting object whose state belongs to it — FB instances carry it; calculation is a momentary transform indifferent to history — FC carries it. Ask two questions — "does it remember?" and "will it be reused for several objects?" — and the choice makes itself.
FB/FC definitions (POU types, instance mechanism) follow IEC 61131-3; creation and calling syntax follow the platform manuals (TIA, CODESYS, TwinCAT, AutoShop); instance-data retention follows each platform's storage documentation.
At review, ask two questions of every POU: "does it keep state?" and "is it reused?" — when the answers match FB/FC, the structure is right.