beautypg.com

Delta Electronics Programmable Logic Controller DVP-PLC User Manual

Page 217

background image

6 Application Instructions API 00-49

DVP-PLC Application Manual

6-5

API Mnemonic

Operands

Function

01

CALL

P

Call Subroutine

Controllers

ES/EX/SS SA/SX/SC EH/SV

OP Range

Program

Steps

P0 ~ P255

CALL, CALLP: 3 steps

PULSE 16-bit 32-bit

ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV

Operands:

S

: The pointer of call subroutine.

Explanations:

1.

Operand S can designate P.

2.

P can be modified by index register E, F.

3.

In ES/EX/SS series models: Operand S can designate P0 ~ P63.

4.

In SA/SX/SC/EH/EH2/SV series models: Operand S can designate P0 ~ P255.

5.

Edit the subroutine designated by the pointer after FEND instruction.

6.

The number of pointer P, when used by CALL, cannot be the same as the number designated by CJ instruction.

7.

If only CALL instruction is in use, it can call subroutines of the same pointer number with no limit on times.

8.

Subroutine can be nested for 5 levels including the initial CALL instruction. (If entering the sixth level, the

subroutine won’t be executed.)

API Mnemonic

Function

02

SRET Subroutine

Return

Controllers

ES/EX/SS SA/SX/SC EH/SV

OP Descriptions

Program

Steps

N/A

Automatically returns to the step immediately following the

CALL instruction which activated the subroutine

SRET: 1 steps

PULSE 16-bit 32-bit

ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV

Explanations:

1.

No operand. No contact to drive the instruction is required.

2.

The subroutine will return to main program by SRET after the termination of subroutine and execute the

sequence program located at the next step to the CALL instruction.

Program Example 1:

When X0 = On, CALL instruction is executed and the program jumps to the subroutine designated by P2. When

SRET instruction is executed, the program returns to address 24 and continues its execution.