Call routine CALL

Runs another routine of this program, then comes back.

The editor with MainRoutine open. Project Explorer shows MainProgram, Routines, MainRoutine and Filling. The rung is a contact on AutoMode and a CALL block with Routine Filling, RUN 1 and an OPEN link.
  1. Routines MainRoutine, marked with the arrow, runs every scan by itself. Filling runs only when a CALL runs it.

  2. Routine The routine this CALL runs: Filling.

  3. OPEN Opens Filling.

The editor with Filling open and selected in Project Explorer. Its rung is a contact on LevelLow and a coil on FillValve. The status line reads Last scan: Executed this scan, called from MainRoutine.
  1. Filling Open in its own tab.

  2. Last scan Executed this scan, called from MainRoutine. With AutoMode off it shows Not called in the last scan.

How it works

Runs the selected routine of the same Program at this point of the scan, then continues with the next step.

How it's used

Use CALL to run a routine only when it is needed, such as the filling logic in auto mode.

MainRoutine
Filling
TagValue
AutoMode1
LevelLow1
FillValve1

AutoMode is on, so Filling runs and opens FillValve. With AutoMode off, Filling does not run at all.

Operands

OperandData typeRead or write
RoutineReads

Common mistakes

  • Expecting a routine to run on its ownOnly the main routine runs by itself. Other routines run only where a CALL runs them.

Related