3 . I n s t r u c t i o n S e t
M N050 03003E F or mo re infor ma tio n vi sit:
w w w. e a t o n . c o m
3-37
API Mnemonic
Function
02
SRET Subroutine
Return
OP Range
Program
Steps
N/A
Automatically returns to the step immediately following the CALL
instruction which activated the subroutine
SRET: 1 steps
ELC ELCB
ELCM
PB PC/PA/PH
PV
PB PH/PA
32 16
P
32 16
P
32 16
P 32 16 P 32 16
P
Description:
Indicates the end of a subroutine program. The subroutine will return to the main program and
begin execution with the instruction after the CALL instruction.
Program Example 1:
When X0 = ON, the CALL instruction will jump to P2 and run the subroutine. With the execution of
the SRET instruction, it will jump back to step 24 and continue execution.
20
24
P2
Subroutine
Subroutine return
Call subroutine P2
CALL
P2
X0
X1
SRET
FEND
Y0
M1
Y1
M2
Y2
Program Example 2:
1.
When the rising-edge of X20 is triggered, the CALL P10 instruction will transfer execution to
subroutine P10.
2.
When X21 is ON, execute CALL P11, jump to and run subroutine P11.
3.
When X22 is ON, execute CALL P12, jump to and run subroutine P12.
4.
When X23 is ON, execute CALL P13, jump to and run subroutine P13.
5.
When X24 is ON, execute CALL P14, jump to and run subroutine P14. When the SRET
instruction is reached, jump back to the last P*** subroutine and keep executing until the last
SRET instruction is reached which will return execution back to the main program.
Summary of Contents for ELC-PB
Page 1: ......
Page 5: ...For more information visit www eaton com MN05003003E iv...
Page 29: ...ELC Programming Manual For more information visit www eaton com MN05003003E 1 24 MEMO...
Page 502: ...3 Instruction Set MN05003003E For more information visit www eaton com 3 333...
Page 601: ...ELC Programming Manual For more information visit www eaton com MN05003003E 3 432...
Page 625: ...ELC Programming Manual For more information visit www eaton com MN05003003E 3 456...