ST Logic Blocks
Globals
Global variables are your project's shared memory. ST blocks read and write them to coordinate state across the whole machine — a run flag, a part counter, a setpoint. (For a primer, see the Global Variables tutorial.)
Referencing a global
Address a global with the Global. prefix. Arrays and maps are indexed:
| Kind | Form | Example |
|---|---|---|
| Scalar | Global.Name | Global.PartCount |
| Array element | Global.Name[i] | Global.LaneCount[2] |
| Map value | Global.Name['key'] | Global.Setpoints['zoneA'] |
A mini example
Sum four lane counters into a running total — a FOR loop over an array global:
(* Running total across four lanes *) Global.Total := 0; FOR i := 0 TO 3 DO Global.Total := Global.Total + Global.LaneCount[i]; END_FOR;
Globals map automatically
When the block runs in a composite, its global references are matched to project globals by name — usually there is nothing to configure. They still appear as global refs on the instance so you can confirm or override them.