Ret (Return) Instruction - Siemens S7-1200 System Manual

Hide thumbs Also See for S7-1200:
Table of Contents
Basic instructions
7.8 Program control operations
Table 7- 98
Data type
Byte, Word, DWord
SInt, Int, DInt, USInt, UInt,
UDInt, Real, LReal, Time, TOD,
SWITCH box placement rules
● No LAD/FBD instruction connection in front of the compare input is allowed.
● There is no ENO output, so only one SWITCH instruction is allowed in a network and the
SWITCH instruction must be the last operation in a network.

RET (Return) instruction

The optional RET instruction is used to terminate the execution of the current block. If and
only if there is power flow to the RET coil (LAD) or if the RET box input is true (FBD), then
program execution of the current block will end at that point and instructions beyond the RET
instruction will not be executed. If the current block is an OB, the "Return_Value" parameter
is ignored. If the current block is a FC or FB, the value of the "Return_Value " parameter is
passed back to the calling routine as the ENO value of the called box.
You are not required to use a RET instruction as the last instruction in a block; this is done
automatically for you. You can have multiple RET instructions within a single block.
For SCL, see the RETURN (Page 274) statement.
Table 7- 99
Return_Value (RET) execution control instruction
Table 7- 100 Data types for the parameters
Data type
SWITCH box data type selection and allowed comparison operations
Not equal
Not equal
Greater than or equal
Less than or equal
Greater than
Less than
Terminates the execution of the current block
The "Return_value" parameter of the RET instruction is assigned to the ENO output
of the block call box in the calling block.
Operator syntax
S7-1200 Programmable controller
System Manual, 03/2014, A5E02486680-AG

Hide quick links:

Table of Contents

Table of Contents