Operation Manual
316
4.34 Programming with Variables
# variables
The CNC PILOT uses value ranges to define the scope of variables:
#0 to #29 Channel-dependent, global variables can be used for
each slide (NC channel). Identical variable numbers on different
slides are no problem. The variables are retained after the program
has been completed and can be processed by the following NC
program.
#30 to #45 Channel-independent, global variables are available
once within the control. If the NC program changes a variable, it
applies to all slides. The variables are retained after the program has
been completed and can be processed by the following NC
program.
#46 to #50 Variables reserved for expert programs: Do not use
these variables in your NC program.
#256 to #285 Local variables are effective only within a
subprogram.
Read parameter values in # variables
Syntax: #1 = PARA(x,y,z)
x = Parameter group
1: Machine parameters
2: Control parameters
3: Setup parameters
4: Machining parameters
5: PLC parameters
y = Parameter number
z = Sub-parameter number
As of software version 625 952-02:
Check numerical value for specified bit
Syntax: #1 = BITSET(x,y)
x = Bit number (0 to 15)—can be
replaced by a # variable.
y = Numerical value (0 to 65535)—
can be replaced by a # variable.
The function returns 1 if the numerical
value contains the interrogated bit.
Otherwise, 0 is returned.
Bit => Numerical
value:
0 => 1
2 => 4
4 => 16
6 => 64
8 => 256
10 => 1024
12 => 4096
14 => 16384
1 => 2
3 => 8
5 => 32
7 => 128
9 => 512
11 => 2048
13 => 8192
15 => 32768
Example:
. . .
[reads machine dimension 1 Z in variable
#1]
N.. #1=PARA(1,7,2)
. . .
N.. #1=#1+1
N.. G1 X#1
N.. G1 X(SQRT(3*(SIN(30)))
N.. #1=(ABS(#2+0.5))
. . .
Positions and dimensions are always indicated in metric
form. This also applies when an NC program is run in
inches.
NC information in # variables
#768, #770 Last programmed position X (radius value), Y, Z
#771 Last programmed position C [°]
#772 Active operating mode:
2: Machine
3: Simulation
4: TURN PLUS
#774 TRC/MCRC status:
40: G40 active
41: G41 active
42: G42 active
#775 Number of the selected C axis
#776 Active wear compensation (G148):
0: DX, DZ
1: DX, DZ
2: DX, DS
#778 Unit of measure: 0=metric; 1=inch
#782 Active working plane:
17: XY plane (front or back)
18: XZ plane (turning)
19: YZ plane (side view/surface)
#783, #785,
#786
Distance between tool tip and slide zero point Y, Z, X