Parameters and parameter calculation (P)

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

:

Syntax:

P..

Standard parameter

P..

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.

Syntax:

P..[<idx>] {[<idx>]}

Parameter arrays

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

Parameters can be created (and initialised as required) in an NC program either within a declaration block which starts with #VAR and ends with #ENDVAR or implicitly with 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.

Syntax:

#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 is provided for this:

Syntax:

#DELETE P.. {, P..}

Programing Example

prg_example

#DELETE P..

#DELETE P10, P20, P100, P200, P201

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

Parameters receive their values 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 arithmetical expressions can also be used instead of the direct assignment of numerals (see Section Mathematical expressions).The known mathematical rules apply for inputs, e.g.: