STE 58762 2-24
When you execute this program, K1 will be passed off as 15 (to N1 of the subprogram) and K2 will
be passed off as 28 (to N2 of the subprogram). The su bprogram will add these together and call
the result (which is 43) N3. The K variable of the main program will also change to 43. The
RETURN command will send control back to the main program, and the PRINT K statement will be
executed. This will cause the number "43" to be displayed on the teach pendant.
Note that subprograms may not call themselves. Also, should you call a subprogram which is in
another file, the controller will not understand you and instead will treat the name of that
subprogram as an error.
Note 1) An expression itself, result of vector data expression such as position data and vector
data element can be designated as an argument.
Note 2) When a constant is used as an argument, it cannot be substituted into a variable
according to a subprogram.
Note 3) For a variable which is an argument to a subprogram, a value should be substituted into
the variable before the subprogram is executed.
2.8.3 Library
The SCOL language does not allow you to use subprograms which are not in the same file as the
main program. However, by putting especially useful subprograms in the library file (SCOL.LIB),
you can access these subprograms from all files.
Many useful subprograms have already been inserted in the library file including subprograms to
get the system ready and subprograms to operate the hand. Appendix C shows the contents of
the library file SCOL.LIB provided as standard on the robot controller system disk.
When writing your own subprogram to add to the library file, enter the program in that file just like
you would enter any other subprogram. For information on how to enter a program into a file, refer
to the Start-up Manual and the Operating Manual. Be sure to put any newly created files at the
very end of the existing library file.
Should a subprogram in the library file and a subprogram in the main file have the same name,
the controller will execute the subprogram in the main file (and not the subprogram in the library
file). The library is reloaded at program selection.