StateTick Docs Home →
ST Logic Blocks

Assignment

Assignment is how an ST block writes a value. The := operator takes the result on its right and stores it in the target on its left — every scan, top to bottom.

The := operator

Left side is the target (where to write); right side is any expression (what to write). Each statement ends with a semicolon:

Global.SystemOn := TRUE;
Global.Setpoint := Param.Target;
Motor.IMotor.Coil := Global.SystemOn;

Don't confuse := with =. := assigns; a single = is a comparison that returns true/false. Global.X = 5 tests whether X is 5; Global.X := 5 sets it.

What can be a target

TargetExample
A globalGlobal.PartCount := 0;
An array elementGlobal.Buffer[i] := 0;
A map valueGlobal.Setpoints['zoneA'] := 70.0;
An equipment signalMotor.IMotor.Coil := TRUE;

Parameters are read-only — you can read Param.X but not assign to it. Compute with a parameter and write the result to a global or equipment signal.

Evaluation order

Statements run in order, once per scan. A later assignment overrides an earlier one — useful for a default-then-override pattern:

Global.State := 0;                (* default *)
IF Global.Fault THEN
    Global.State := 9;            (* override on fault *)
END_IF;