Program instructions
7.18 Subroutine
S7-200 SMART
System Manual, 09/2015, A5E03822230-AC
351
Example: Subroutine call using string parameter
This example copies a different string literal to a unique address depending upon the given
input. The unique address of this string is saved. The string address is then passed to the
subroutine by using an indirect address. The data type of the subroutine input parameter is
string. The subroutine then moves the string to a different location.
A string literal can also be passed to the subroutine. The string reference inside the
subroutine is always the same.
MAIN
LD I0.0
SCPY "string1", VB100
AENO
MAIN
LD I0.1
SCPY "string2", VB200
AENO
MOVD &VB200, VD0
MAIN
LD I0.2
CALL SBR_0, *VD0
MAIN
LD I0.3
CALL SBR_0, "string3"
SBR0
LD SM0.0
SSCPY *LD0, VB300