The leader in industrial automation and control solutions

Instruction Parameters

Supported PLC Series

PLC-AESPLC-FBPLC-ES

Supported Data Registers

MXYKLFTCSZRQD@DConstant
PID
n

Supported Flags

FlagBitSupport
ErrorF11.0
ZeroF11.1
CarryF11.2

Number of Steps

Steps
2

Operands

OperandDescription
PIDThe first operand.
Entries are only constants.
This is the external program ID.
nThe second operand.
Entries are only constants.
This is the subroutine ID.

The value range is 0 ~ 127.

Notice

Notice

Errors will occur when the following conditions are met:

  • The END instruction is located between the SBRT and RET instructions.
  • The nesting of the ECALL or ECALLP occurs more than 16 times.
  • The JMP/JMPP ~ JMP/JMPP block is located between the SBRT ~ RET block.

Instruction Behavior

The ECALL and ECALLP instructions behave as follows:

  • The ECALL or ECALLP instructions in a scan program calls the subroutine program of SBRT ~ RET block inside an external program.
    • The external program may be a scan or subroutine program.
  • When the execution condition is ON (1), the ECALL or ECALLP instruction calls the subroutine program, PID, with the assigned subroutine ID number, n.
  • When the subroutine is completed, the program continues execution after the ECALL or ECALLP instructions.
  • The ECALL and ECALLP instructions can be nested up to 16 times.
  • The ECALL and ECALLP instructions can be used multiple times in the same program.
  • When SBRT is duplicated in the external program file, a compile error occurs.

Block vs. Program

This section covers information about the ECALL and ECALLP instructions, where a subroutine program is called. For more information about using a subroutine block, refer to the SBRT, RET, and CALL or CALLP instructions.

Ladder Diagram Examples

ECALL

The ECALL instruction calls a subroutine program ID, n, from an external program, PID.

The ECALL instruction calls a subroutine program ID, n, from an external program, PID.

The main scan program, program ID 0, contains two calls for two different subroutine blocks.

The main scan program, program ID 0, contains two calls for two different subroutine blocks.

The external scan program, program ID 8, will increase the data register, D10, once every scan, due to the INCP one-shot instruction, only if subrouti

The external scan program, program ID 8, will increase the data register, D10, once every scan, due to the INCP one-shot instruction, only if subroutine 1 is called from the main program.

When the contact, M0.0, is powered ON (1), the ECALL instruction executes and calls the subroutine 1 in the program ID 8.

When the contact, M0.0, is powered ON (1), the ECALL instruction executes and calls the subroutine 1 in the program ID 8.

Since the subroutine 1 has been called by the main program, the data register, D10, increases once every scan.

Since the subroutine 1 has been called by the main program, the data register, D10, increases once every scan.

When the contact, M0.1, is powered ON (1), the ECALL instruction executes and calls the subroutine 2 in the program ID 8.

When the contact, M0.1, is powered ON (1), the ECALL instruction executes and calls the subroutine 2 in the program ID 8.

Since the subroutine 1 is actively being called by the main program and subroutine 2 has been called, the data registers, D10 and D11, increase once e

Since the subroutine 1 is actively being called by the main program and subroutine 2 has been called, the data registers, D10 and D11, increase once every scan.

ECALLP

The ECALLP one-shot instruction calls a subroutine program ID, n, from an external program, PID.

The ECALLP one-shot instruction calls a subroutine program ID, n, from an external program, PID. Every time this instruction executes, it energizes the output only once.

The main scan program, program ID 0, contains two calls for two different subroutine blocks.

The main scan program, program ID 0, contains two calls for two different subroutine blocks.

The external scan program, program ID 8, will increase the data register, D10, once every scan, due to the INCP one-shot instruction, only if subrouti

The external scan program, program ID 8, will increase the data register, D10, once every scan, due to the INCP one-shot instruction, only if subroutine 1 is called from the main program.

When the contact, M0.0, is powered ON (1), the ECALLP one-shot instruction executes once every scan and calls the subroutine 1 in the program ID 8.

When the contact, M0.0, is powered ON (1), the ECALLP one-shot instruction executes once every scan and calls the subroutine 1 in the program ID 8.

Since the subroutine 1 has been called by the main program, the data register, D10, increases once every scan.

Since the subroutine 1 has been called by the main program, the data register, D10, increases once every scan.

When the contact, M0.1, is powered ON (1), the ECALLP one-shot instruction executes once every scan and calls the subroutine 2 in the program ID 8.

When the contact, M0.1, is powered ON (1), the ECALLP one-shot instruction executes once every scan and calls the subroutine 2 in the program ID 8.

Since the subroutine 1 is actively being called by the main program and subroutine 2 has been called, the data registers, D10 and D11, increase once e

Since the subroutine 1 is actively being called by the main program and subroutine 2 has been called, the data registers, D10 and D11, increase once every scan.