Topic: DMD0147

Help File Version: 2.9.4.37

GOTO - Go To Label


The Go To Label (GOTO) instruction causes an immediate branch to the Label specified in the instruction and continues the PLC scan at that point in the ladder logic program. The Go To Label (GOTO) instruction can only reference Labels that exist in the same Program or Task as the GOTO instruction. A Go To Label (GOTO) instruction cannot target a label that is in a different stage.

 

The Go To Label (GOTO) instruction can target a Label that is located before the GOTO instruction in the program which effectively creates a repeating loop. The target Label can also be located after the GOTO instruction in the program which will skip over all of the intervening ladder logic. A Go To Label (GOTO) instruction that is within a FOR / NEXT, WHILE / WEND, or REPEAT / UNTIL loop cannot target a label that is outside of that loop. This means that a Go To Label (GOTO) instruction cannot be used to prematurely break out of a loop; use a BREAK or CONTINUE instruction to do this. Placing the Label BEFORE the GOTO in the code-block this will make the Go To Label (GOTO) a looping construct, which will make this a Yielding instruction

 

 

This instruction is a 'power-rail' instruction, meaning that it is displayed in the left-most column of the ladder diagram (the power rail). Creating new instances of this instructions is a bit counter-intuitive because they cannot be entered directly on the power rail in the Ladder Editor. The first step is to position the edit cursor in the output column (the far right) of the rung in the ladder logic diagram instead of positioning it against the power rail (the far left). At that point you can enter the instruction's mnemonic or double click on the instruction's name in the Instruction Toolbox. You can also drag / drop the instruction from the Toolbox anywhere on the rung and it will be created in the power rail of that rung.

 


Parameters:

Note: Use the F9 key to open the Default Element Selection Tool (the Element Picker or the Element Browser) or use the Down-Arrow key (Auto-Complete) on any parameter field to see a complete list of the memory locations that are valid for that parameter of the instruction.

 

Label - the number of the target Label to immediately branch to. This can be any constant value between 0 and 65535.

 


Status Display:

If the Label parameter causes a forward Skip in the ladder logic (because the Label occurs later in the program), there will be a green triangle in the upper left corner of the status display to indicate this is a Skipping instruction.

 

If the Label parameter causes a backward Skip in the ladder logic (because the Label occurs earlier in the program), there will be a blue and green triangle in the upper left corner of the status display to indicate this is both a Yielding and Skipping instruction.

 


See Also:

GOTO - Go To Label

 

LABEL - Program Label

 


Related Topics:

BREAK - Exit Loop

 

CONTINUE - Skip to Loop End

 

FOR - Index Loop

 

NEXT - Index By Step

 

REPEAT - Loop Until Condition is Non-Zero

 

UNTIL - Repeat Until Condition is Non-Zero

 

WEND - While End

 

WHILE - Loop While Condition is Non-Zero

 


Rung Example: