DL205 User Manual, 4th Edition, Rev. B
5–182
Chapter 5: Standard RLL Instructions - Program Control
1
2
3
4
5
6
7
8
9
10
11
12
13
14
A
B
C
D
Goto Subroutine (GTS) (SBR)
The Goto Subroutine instruction allows a section of
ladder logic to be placed outside the main body of the
program and execute only when needed. There can be a
maximum of 128 GTS instructions and 64 SBR
instructions used in a program. The GTS instructions
can be nested up to 8 levels. An error E412 will occur if
the maximum limits are exceeded. Typically this will be
used in an application where a block of program logic
may be slow to execute and is not required to execute
every scan. The subroutine label and all associated logic is
placed after the End statement in the program. When the
subroutine is called from the main program, the CPU will
execute the subroutine (SBR) with the same constant
number (K) as the GTS instruction which called the
subroutine.
By placing code in a subroutine it is only scanned and
executed when needed since it resides after the End
instruction. Code which is not scanned does not impact
the overall scan time of the program.
Subroutine Return (RT)
When a Subroutine Return is executed in the subroutine,
the CPU will return to the point in the main body of the
program from which it was called. The Subroutine
Return is used as termination of the subroutine, which
must be the last instruction in the subroutine and is a
stand alone instruction (no input contact on the rung).
Subroutine Return Conditional (RTC)
The Subroutine Return Conditional instruction is a
optional instruction used with an input contact to
implement a conditional return from the subroutine. The
Subroutine Return (RT) is still required for termination
of the Subroutine.
K
aaa
GTS
230
2
4
0
2
5
0
-1
2
6
0
ý
þ
þ
þ
K
aaa
SBR
RT
230
2
4
0
2
5
0
-1
2
6
0
ý
þ
þ
þ
RT
C
230
2
4
0
2
5
0
-1
2
6
0
ý
þ
þ
þ
Operand Data Type
DL240 Range
DL250-1 Range
DL260 Range
aaa
aaa
aaa
Constant K
1-FFFF
1-FFFF
1-FFFF
DS
Used
HPP Used
DS
Used
HPP Used