beautypg.com

Sret – Delta Electronics Extension Digital I/O Module DOP-EXIO14RAE User Manual

Page 87

background image

Appendix D Use of Application Instructions|DOP-EXIO Series

D-6

Revision March, 2008, Doc. Name: 2007PDD23000014

Mnemonic

Operands Function

SRET

None Subroutine

Return

Bit Devices

Word Devices

X Y M S K H

KnX

KnY

KnM KnS

T

C

D

E

F

y

Note:

1. No

operand.

2. No contact to drive the instruction is required.

16-bit instruction (1 Step)

SRET

Continuous
execution

- -

32-bit instruction

- -

- -

y

Flags: None

Explanations:
1. This instruction denotes the end of the subroutine program.
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.

X0

X1

CALL

P2

Y1

20

P***

24

FEND

SRET

P2

Y0

Y0

Subroutine P2

subroutine return

call subroutine P***

Program Example 2:
1. When X10 goes from Off to On, its rising-edge trigger executes CALL P10 instruction and the

program jumps to the subroutine designated by P10.

2. When X11 is On, CALL P11 is executed and the program jumps to the subroutine designated by

P11.

3. When X12 is On, CALL P12 is executed and the program jumps to the subroutine designated by

P12.

4. When X13 is On, CALL P13 is executed and the program jumps to the subroutine designated by

P13.