356 ISO Programming
4.31 Programming with Variables
#g200 .. #g299 Channel-independent, global INTEGER variables
are provided once within the control. If the NC program changes a
variable, it applies to all slides. The variables are retained even when
the control is switched off, and can be evaluated again after power-
up.
#x1 .. #x20 Channel-dependent, local text variables are effective
within a main or subprogram. They can only be read on the channel
to which they were written.
Machine dimensions
#m1(n) .. #m9(n) “n” is the designation of the axis (X, Z, Y) for
which the machine dimension is to be read or written. The variable
calculation uses the table “mach_dim.hmd”.
Simulation: During the startup of the control, the table
“mach_dim.hmd” is read by the simulation. The simulation function
now uses the table of the simulation.
Tool compensation
#dt(n): “n” is the compensation direction (X, Z, Y, S) and “t” is the
turret pocket number assigned to the tool. The variable calculation
uses the table “toolturn.htt”.
Simulation: When the program is selected, the table “toolturn.htt”
is read by the simulation. The simulation function now uses the table
of the simulation.
Event bits: Variable programming interrogates a bit of the event for 0
or 1. The meaning of the event is determined by the machine
manufacturer.
#en(key): “n” is the channel number and “key” is the event name.
Used for reading external events set by the PLC.
#e0(key[n].xxx) “n” is the channel number, “key” is the event
name, and “xxx” is the name extension. Used for reading external
events set by the PLC.
If the variables are to be retained in the memory when the
control is switched off, this feature must be activated by
the machine tool builder (configuration parameter:
“Channels/ChannelSettings/CH_NC1/CfgNcPgmParState/
persistent=TRUE”).
If this feature is not activated, the variables values will
always be “zero” after power-up.
Example: Machine dimensions
. . .
N.. G1 X(#m1(X)*2)
N.. G1 Z#m3(Z)
N.. #m4(Z)=350
. . .
Example: Tool compensation
. . .
N.. #d3(X)=0
N.. #d3(Z)=0.1
N.. #d3(S)=0.1
. . .
Example: Events
. . .
N.. IF #e1(“PlcEventKey“)
N.. THEN
. . .
N.. IF #e0(“PlcisKey[1].Turn“)
N.. THEN
. . .