December 2001 Linking Files 7 – 175
7.14.1 USES INSTRUCTION (USES)
Syntax: USES <file name>
Operands: None
Action:
You can use the USES instruction in the main program to link other files. Files
that are linked with USES can themselves also use the instruction to link
further files. It is also permissible to use the USES instruction to link a single
file to several other files. The code for this file is generated only once. The
USES instruction requires a file name as an argument. The USES instruction
only links a file; it does not run the file’s program code. The USES instruction
cannot be compared with a CM instruction. The linked files must therefore
contain individual modules that you can then call with the CM instruction.
Example:
USES PLCMOD1
USES EPRUPG
USES RAMPLC
Linking of files:
Function STL
Main program PLCMAIN.PLC
Link the file for spindle control. USES SPINDEL.PLC
Link the file for tool change. USES TCHANGE.PLC
Program code
Function STL
File for spindle control SPINDEL.PLC
Integrate file with general subroutines. USES PLCUPG.PLC
Program code
Function STL
File for tool change TCHANGE.PLC
Integrate file with general subroutines. USES PLCUPG.PLC
Program code
Function STL
File with general subroutines PLCUPG.PLC
Program code