Write a machine once and stamp out as many copies as you need, each with its own private memory: that is what a function block gives you. Here you build a robot template and then run a whole line of them.
The template (defined once)
FUNCTION_BLOCK FB_Robot VAR_INPUT Run : BOOL; // pulse to make a part END_VAR VAR_OUTPUT PartsMade : UINT; END_VAR VAR count : UINT; // private memory END_VAR
The body (runs every cycle)
IF Run THEN count := count + 1; END_IF; PartsMade := count;
π‘ Defining FB_Robot doesn't build anything yet; it's a cookie cutter sitting in a drawer. You get a working robot only when you create an instance of it.
Each instance is a real robot with its own count. Add a few, then run cycles and watch every robot keep its own tally. Click one robot to cycle just that one.
π Click an individual robot to pulse only its Run. The others don't change, which shows each instance's memory is completely separate.
In your program's variable table
// add a robot to see this grow
Calling Arm1(Run := TRUE) touches only Arm1's count. Arm2 is a different robot with its own drawer of memory: same blueprint, separate state. That independence is what lets function blocks scale across a whole machine.
You have Arm1 and Arm2, both of type FB_Robot. You call Arm1(Run := TRUE) five times. What is Arm2.PartsMade?