Skip to main content

Example - Ladder Diagram

ECALL


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

Ladder Diagram Example


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 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.



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.



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.
Every time this instruction executes, it energizes the output only once.

Ladder Diagram Example


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 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.



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.



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.