Industrial Engineer · phase 3 of 16

Routine / Function

Reusable or callable unit of logic that performs a defined operation.

The Explain card

Plain English
A routine is a named piece of logic inside a program, and a function is a callable piece of logic that returns a result. Both exist so you can name a job and call it instead of repeating it.
Example
A Main routine calls an Alarms routine, a Motors routine and a Sequence routine in order every scan. A scaling function is called with raw counts and hands back engineering units.
Why it matters
A routine that is never called never runs, which is the first thing to check when new logic seems dead. Functions keep no memory between calls, so anything that needs to remember goes in a function block instead.
Hook
Name the job once and call it by name.

Where it sits in the deck

Phase 3: PLC Program Organization and Execution

How the logic is arranged and how the scan actually runs it, which is the difference between code that works and code that works every time.