Parameters and parameter calculation

In NC programs, parameters can be used as placeholders for numerical values. The advantage of parameters is that the value of a parameter may be changed during the program flow. This allows the production of flexible NC programs.

A parameter is designated by "P” followed by a number without blank.

Programing Example

prg_example

Parameters and parameter calculation

In a sub-routine, e.g. a drilling cycle, instead of coordinate values (drill depth, drill feed, dwell etc.) parameters are used. The parameters are then assigned the final values in each calling main program:

Application example of parameter calculation
Application example of parameter calculation

The call in the main program then looks like this:

:

N100 P10=20.5 P11=12.6 P12=1.2

N110 L4712

:

P<expr>                                                                                                                  simple parameter

P<expr>

The parameter index must always be greater than zero. However, it can assume any desired value. The maximum number of parameters used in the channel is fixed [6]-6.19.

 

Parameter arrays (e.g. P100[50]) are also allowed in addition to plain parameters. The dimension of the arrays is fixed [6]-6.20.

P<expr>[<expr>] { [<expr>] }                                                                                       Parameter arrays

The channel parameter P-CHAN-00067 specifies whether the P parameters are active program global.

Parameters can be created in the NC program in a declaration block (and initialised as required). It starts with #VAR and ends with #ENDVAR Or implicitly at the first write access. However, parameter arrays must always be created in a declaration block.

For a better overview, the initialisation of a parameter array can be written over several NC blocks by using the "\” character. The following syntax is used for the creation operation:

# VAR                                      Start of declaration block

:

:

:

#ENDVAR                             End of declaration block

Programing Example

prg_example

#VAR and #ENDVAR

#VAR

P10[3][6] = [10,11,12,13,14,15, \

             20,21,22,23,24,25, \

             30,31,32,33,34,35 ]

P20[3][4] = [40,41,42,43, 50,51,52,53, 60,61,62,63]

P100

#ENDVAR

P200 = 10 P201=11

:

Notice

notice

Access to parameter arrays starts at index 0. Based on the example above, access P10[0][5] gives the value 15.

Parameters and parameter arrays can also be deleted in the NC program. The #DELETE command with the following syntax is provided for this:

#DELETE P<expr> {, P<expr>}

Programing Example

prg_example

#DELETE P

#DELETE P10, P20, P100, P200, P201

In addition, the SIZEOF and EXIST functions are provided (see Section Arithmetic expressions <expr>) to define the dimension size of parameter arrays and to check the existence of parameters.

Parameters are assigned by the NC program, e.g. P12=0.12. They also allow the processing of control-dependent or process-dependent values of the control system, e.g.:

etc.

Linked arithmetic expressions can also be used instead of the direct assignment of numerals (see Section Mathematic expressions).The known mathematical rules apply for inputs, e.g.: