Flexible NC programming
1.1 Variables
Job planning
Programming Manual, 07/2010, 6FC5398-2BP40-0BA0
23
1.1.5 Definition of user variables (DEF)
Function
The DEF command is used to define user-specific variables and assign values to them. To set
them apart from system variables, these are called user-defined variables or user variables
(user data).
According to range of validity (in other words, the range in which the variable is visible) there
are the following categories of user variable:
● Local user variables (LUD)
Local user variables (LUD) are variables defined in a part program which is not the main
program at the time of execution. They are created when the part program is called and
deleted at the end of the part program or when the NC is reset. Local user variables can
only be accessed within the part program in which they are defined.
● Program-global user variables (PUD)
Program-global user variables (PUD) are user variables defined in a part program used
as the main program. They are created when the part program starts up and deleted at
the end of the part program or when the NC is reset. It is possible to access PUD in the
main program and in all subprograms of the main program.
● Global user variables (GUD)
Global user variables (GUD) are NC- or channel-global variables which are defined in a
data block (SGUD, MGUD, UGUD, GUD4 to GUD9) and are retained following shutdown
and restart. GUD can be accessed in all part programs.
User variables must be defined before they can be used (read/write). The following rules
must be observed in this context:
● GUD have to be defined in a definition file, e.g. _N_DEF_DIR/_M_SGUD_DEF.
● PUD and LUD have to be defined in a definition section of the part program.
● The data must be defined in a dedicated block.
● Only one data type may be used for each data definition.
● A number of variables of the same data type can be defined for each data definition.
Syntax
DEF <range> <type> <PP_stop> <init_time> <phys_unit> <limit_values>
<access_rights> <name>[<value_1>,<value_2>,<value_3>]=<init_value>