CALLEUJSRUSCALLJSR Function call (FC) / Call a routine (JSR)Function call (FC)Call a routine (JSR)

Also called: subroutine, JSR (Jump to Subroutine), call, function call (FC)

Calls a routine (or an FC function) when the rung is 1.

What it does

The call runs the rungs of another routine, then comes back to the rest of the program. A program can thus be split into readable pieces.

When to use it

To organise a program: one routine per machine or per mode, a function reused with parameters.

Operands

European mnemonicAmerican mnemonicNameData typeDirectionRequiredMeaning
ENENEnableBOOLInputYesCall condition.
Routine / FCRoutine / FCCalled routine—InputYesRoutine (or FC) called.
ParametersParametersParametersBOOL, INT, DINT, REAL, TIME / DINTInput and outputYesOne operand per routine parameter: inputs on the left, outputs on the right.
MnemonicNameData typeDirectionRequiredMeaning
ENEnableBOOLInputYesCall condition.
Routine / FCCalled routine—InputYesRoutine (or FC) called.
ParametersParametersBOOL, INT, DINT, REAL, TIMEInput and outputYesOne operand per routine parameter: inputs on the left, outputs on the right.
MnemonicNameData typeDirectionRequiredMeaning
ENEnableBOOLInputYesCall condition.
Routine / FCCalled routine—InputYesRoutine (or FC) called.
ParametersParametersBOOL, INT, DINT, REALInput and outputYesOne operand per routine parameter: inputs on the left, outputs on the right.

Example

European style
American style

When S1 is 1, routine Tank runs with Level = V1.

Try it in the simulatorThe example opens in the free simulator; your own program stays as it was.

Behaviour in detail

European (IEC) and American styles

European: call of an FC function with its input and output parameters and its temporaries.

American: JSR (jump to subroutine) to a routine of the program, parameters received with SBR and returned with RET.

See also