Parameters and parameter calculation
In NC-program parameters can be used as place-holder for numerical values. The advantage of parameters is that the value of a parameter may be altered during the program flow. This allows the development of flexible NC-program.
Either the R-word or the P-word is used depending upon configuration for parameter designation [6]-6.44. In the examples described here, P-parameters are used.
Programming example
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 allocated with the final values in the respective calling main program :
Fig.64: Example for application of parameter calculationThe call, in the main program will appear as follows:
:
N100 P10=20.5 P11=12.6 P12=1.2
N110 L4712
: P <expr> Standard parameterP<expr> The parameter index must always be greater than zero, however it can assume any desired value. The maximum number of parameters to be used can be configured [6]-6.19.
In addition to plain parameters, also parameter arrays (e.g. P100[50]) are allowed. The dimension of the arrays can be configured [6]-6.20.
P <expr> [ <expr> ] { [<expr>] } Parameter arraysVia the channel parameters list it can be specified [1]-12, if the P-parameters will be program-globally active.
Parameters can be created (and eventually initialized) in a NC-program either within a declarations block which starts with #VAR and is closed with a #ENDVAR, or implicitly with the first write access. But parameter arrays must always be created inside a declarations block. To the better overview the initialization of a parameter array can be written over several NC blocks by using the \-character. The following syntax is used for creating:
#VAR Start of declaration block
:
: Declaration and initialization part
:
#ENDVAR End of declaration block
Programming example
#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
: Parameters and parameter arrays can also be deleted within the NC-program. For that, the #DELETE command with the following syntax is available:
#DELETE P <expr> {,P<expr>}Programming example
#DELETE P10, P20, P100, P200, P201Furthermore, the SIZEOF and the EXIST function (see chapter Arithmetical expressions <expr>) are used to determine the dimensions size of parameter arrays and for checking the existence of parameters.