EasyManua.ls Logo

Siemens SIMATIC S7-1200

Siemens SIMATIC S7-1200
1614 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Basic instructions
8.8 Program control operations
S7-1200 Programmable controller
System Manual, V4.2, 09/2016, A5E02486680-AK
325
8.8.10.9
GOTO statement
Table 8- 165 GOTO statement
SCL
Description
GOTO JumpLabel;
Statement;
... ;
JumpLabel: Statement;
The GOTO statement skips over statements by jumping to a label in the same
block.
The jump label ("JumpLabel") and the GOTO statement
must be in the same block.
The name of a jump label can only be assigned once within a block. Each jump
label can be the target of several GOTO statements.
It is not possible to jump to a loop section (FOR, WHILE or REPEAT). It is possible to jump
from within a loop.
Example: GOTO statement
In the following example: Depending on the value of the "Tag_value" operand, the execution
of the program resumes at the point defined by the corresponding jump label. If "Tag_value"
equals 2, the program execution resumes at the jump label "MyLabel2" and skips
"MyLabel1".
CASE "Tag_value" OF
1 : GOTO MyLabel1;
2 : GOTO MyLabel2;
ELSE GOTO MyLabel3;
END_CASE;
MyLabel1: "Tag_1" := 1;
MyLabel2: "Tag_2" := 1;
MyLabel3: "Tag_4" := 1;
8.8.10.10
RETURN statement
Table 8- 166 RETURN instruction
SCL
Description
RETURN;
The Return instruction exits the code block being executed without conditions. Program execu-
tion returns to the calling block or to the operating system (when exiting an OB).
Example: RETURN instruction:
IF "Error" <> 0 THEN
RETURN;
END_IF;
Note
After executing the
last instruction, the code block automatically returns to the calling block.
Do not insert a RETURN instruction at the end of the code block.

Table of Contents

Other manuals for Siemens SIMATIC S7-1200

Related product manuals