![](/images/new-backgrounds/1256769/256769337x1.webp)
20 Custom Macro
20.6 Subprogram Call with T Code
With parameter T(9034)=1 set, the value of T written in the program will not be transferred to the PLC, instead, the T code will initiate the call of subprogram No. O9034.
Now block
Gg Xx Yy Tt
will be equivalent to the following two blocks:
#199=t
Gg Xx Yy M98 P9034
The value assigned to address T will be transferred as an argument to common variable #199.
If reference is made to address T again in the subprogram started upon code T, the subprogram will not be called over again, but the value of address T will be transferred already to the PLC.
If a user call of G, M, S, A, B, C is made in the subprogram, FGMAC=0, not enabled (executed as an ordinary codes M, S, ... G) FGMAC=1, enabled, i.e. a new call is generated.
20.7 Subprogram Call with S Code
With parameter S(9033)=1 set, the value of S written in the program will not be transferred to the PLC, instead, the call of subprogram O9033 will be initiated by the S code.
Now block
Gg Xx Yy Ss
is equivalent to the following two blocks:
#198=s
Gg Xx Yy M98 P9033
The value assigned to address S will be transferred as an argument to common variable #198.
If reference is made to address S again in the subprogram started by S code, the subprogram will not be called again, but the value of the address will be transferred already to the PLC.
If a user call of G, M, T, A, B, C is made in the subprogram, FGMAC=0, not enabled (executed as an ordinary codes M, S, ... G) FGMAC=1, enabled, i.e. a new call is generated.
20.8 Subprogram Call with A, B, C Codes
If address A, B or C is defined as an auxiliary function by parameters (1493 A.MISCEL=1, 1496 B.MISCEL=1, or 1499 C.MISCEL=1) and parameter A(9030)=1, or B(9031)=1, or C(9032)=1 is set, the value of A, B or C written in the program will not be transferred to the PLC or the interpolator, instead the call of subprogram No.O9030, O9031 or O9032 will be initiated by code A, B or C, respectively.
Now e.g. block
Gg Xx Yy Bb
is equivalent to the following two blocks:
#196=b
Gg Xx Yy M98 P9031
The values assigned to addresses A, B and C will be transferred to common variables #195, #196,and #197, respectively.
169