Technical data

Diagnostics
23.9 Program Measures for Handling Errors
Programming with STEP 7
502 Manual, 05/2010, A5E02789666-01
You can find detailed information on OBs, SFBs, and SFCs in the corresponding Help on Blocks.
23.9.1 Evaluating the Output Parameter RET_VAL
Using the RET_VAL output parameter (return value), a system function indicates whether or not
the CPU was able to execute the SFC function correctly
Error Information in the Return Value
The return value is of the integer data type (INT). The sign of an integer indicates whether it is a
positive or negative integer. The relationship of the return value to the value "0" indicates whether
or not an error occurred while the function was being executed (see table):
If an error occurs while the function is being executed, the return value is less than "0." The
sign bit of the integer is "1."
If the function is executed free of errors, the return value is greater than or equal to "0." The
sign bit of the integer is "0."
Processing of the SFC by the CPU Return Value Sign of the Integer
Error occurred Less than "0" Negative (sign bit is "1")
No error Greater than or equal to
"0"
Positive (sign bit is "0")
Reacting to Error Information
If an error occurs while an SFC is being executed, the SFC provides an error code in the return
value (RET_VAL).
A distinction is made between the following:
A general error code that all SFCs can output and
A specific error code that the SFC can output depending on its specific function.
Transferring the Function Value
Some SFCs also use the output parameter RET_VAL to transfer the function value, for example,
SFC64 TIME_TCK transfers the system time it has read using RET_VAL.
You can find more detailed information on the output parameter RET_VAL in the Help on
SFBs/SFCs.