Studio 5000 Β· Track 03 Β· the Logix way to reuse

Build Your Own Instruction

In Logix you don't copy-paste a routine to reuse it β€” you package it as an Add-On Instruction. Define the logic once, give it parameters, and it drops onto the rung like a built-in instruction. Each instance carries its own tag, so a motor AOI works identically on motor 1 or motor 50, never sharing state.

πŸ“₯ Input paramsπŸ“€ Output paramsπŸ”’ Local tags
01 Β· One definition, three instances

Define once, instance everywhere

The AOI aoi_Motor is defined once at the top β€” its interface (Inputs, Outputs) and hidden Local tags. Below, it's instanced on three conveyor motors. Each instance is a separate backing tag (Mtr_1, Mtr_2, Mtr_3): run one and only its state changes. Same code, isolated data β€” exactly like an FB elsewhere, but Rockwell-flavoured.

πŸ“¦ Add-On Instruction definition β€” aoi_Motor

Start : BOOL (In) Stop : BOOL (In) Running : BOOL (Out) Runtime : DINT (Out) SealIn : BOOL (Local) RunTmr : TIMER (Local)

Press "Fix a bug" β€” one edit to the definition instantly applies to all three instances, because they share the same code. Yet Mtr_1.Runtime never bleeds into Mtr_2. AOIs are also version-stamped and can be source-protected, so a vendor ships logic you use but can't see.

02 Β· The parameter kinds

Inputs, Outputs & Locals

πŸ“₯ Input parameters β€” values passed in each scan (Start, Stop, a setpoint). Copied in when the instruction executes.

πŸ“€ Output parameters β€” results the AOI produces (Running, Fault, Runtime). Visible to the calling routine.

πŸ”’ Local tags β€” the AOI's private workspace (seal-in bits, timers). Hidden from the outside β€” true encapsulation per instance.

πŸ” InOut β€” a reference to a tag passed by alias (e.g. a whole UDT), so the AOI works on the caller's data directly.

03 Β· Check yourself

When the bug fix lands

You fix a bug in aoi_Motor, used as 40 instances. How many places must you edit?