hit counter script

Goto Statement; Return Statement - Siemens SIMATIC S7-1200 System Manual

Hide thumbs Also See for SIMATIC S7-1200:
Table of Contents

Advertisement

8.8.10.9

GOTO statement

Table 8- 165 GOTO statement
SCL
GOTO JumpLabel;
Statement;
... ;
JumpLabel: Statement;
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
RETURN;
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.
S7-1200 Programmable controller
System Manual, V4.2, 09/2016, A5E02486680-AK
Description
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.
Description
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).
Basic instructions
8.8 Program control operations
325

Advertisement

Table of Contents
loading

Table of Contents

Save PDF