2 additional function, m-function, 3 use of variables, Additional function, m-function – Lenze PLC Designer PLC-Designer (R2-x) SoftMotion User Manual
Page 68: Use of variables, L-force | plc designer - softmotion

L-force | PLC Designer - SoftMotion
CNC editor
Supported and extended elements of the CNC language of DIN66025
68
L
DMS 5.2 EN 03/2011 TD17
4.1.2
Additional function, M-function
Additional functions or M-functions can be used to set a binary output to start a different
action. These differ from switching points in that the current position is retained until the
M-function is confirmed by the setting of an input. This technique is often used if the
subsequent processing of the program depends on other processes. The following line
would start M-function 10 and wait for it to be confirmed:
K and L can be used to enter two parameters which are copied to the corresponding
SMC_GeoInfo object. During runtime, the application will have the opportunity to access
these values via the SMC_GetMParameters POU whenever the interpolator reaches and
waits at an M-function.
The mechanism described below can only be used if the path is being processed in online
mode (with SMC_NCDecoder):
The global data structure gSMC_MParameters (type: SMC_M_PARAMETERS) stored in the
SM_CNC.lib library can be used to transfer additional parameters. The structure
corresponds to parameters dP1..dP8.
To use a user-defined data structure instead of gSMC_MParameters, transfer it via O$var$.
For example, g_myMParams (type: SMC_M_PARAMETERS) contains the parameters to be
transferred:
4.1.3
Use of variables
Instead of fixed numerical values, variables can also be used. These must be enclosed in $
characters (e.g. R$g_fVar$). In this context, please note that using variables will only work
if the program has been compiled as a program variable and is being processed online by
the decoder POU. The variables are substituted at the point in time at which the decoder
processes the corresponding line.
If the CNC program is compiled as an OutQueue, on the other hand, the variable
mechanism will not work, since the path is generated offline and transferred as an
uneditable application data structure. In this case - as with offline display - the editor will
substitute variables with their initial values.
The use of variables in G-code programs imported online requires some additional
).
N90 M10
N150 M13 0$g_myMParams