Flexible NC programming
1.1 Variables
Job planning
Programming Manual, 07/2010, 6FC5398-2BP40-0BA0
51
See also
Definition and initialization of array variables (DEF, SET, REP): Further Information
(Page
51)
General information about variables (Page 15)
1.1.13 Definition and initialization of array variables (DEF, SET, REP): Further
Information
Further information (SET)
Initialization during definition
● Starting with the 1st array element, as many array elements are assigned with the values
from the value list as there are elements programmed in the value list.
● A value of 0 is assigned to array elements without explicitly declared values in the value
list (gaps in the value list).
● For variables of the AXIS data type, gaps in the value list are not permitted.
● If the value list contains more values than there are array elements defined, an alarm will
be displayed.
Value assignment in program execution
In the case of value assignment in program execution, the rules described above for
definition apply. The following options are also supported:
● Expressions are also permitted as elements in the value list.
● Value assignment starts with the programmed array index. Values can be assigned
selectively to subarrays.
Example:
Program code Comments
DEF INT ARRAY[5,5] ; Array definition
ARRAY[0,0]=SET(1,2,3,4,5) ; Value assignment to the first 5 array
elements [0,0] - [0,4]
FELD[0,0]=SET(1,2, , ,5) ; Value assignment with gap to the first 5
array elements [0,0] - [0,4], array
elements[0,2] and [0,3] = 0
ARRAY[2,3]=SET(VARIABLE,4*5.6) ; Value assignment with variable and
expression starting at array index [2,3]:
[2,3] = VARIABLE
[2,4] = 4 * 5.6 = 22.4