8 changing variable values, Changing variable values, L-force | plc designer - softmotion – Lenze PLC Designer PLC-Designer (R2-x) SoftMotion User Manual

Page 71

Advertising
background image

DMS 5.2 EN 03/2011 TD17

L

71

L-force | PLC Designer - SoftMotion

CNC editor

Supported and extended elements of the CNC language of DIN66025

4.1.8

Changing variable values

Commands G36 and G37 are provided to the user to write or change variables. The variable

to be changed is entered using O$var$. D is used to set the value to be written (G36) or

added (G37) to the variable.
The following example sets global variable g_i to 5:

The following example leads to lines 1010 and 1020 being traversed five times:

Please note that this mechanism will only work if the path is being processed in online

mode, since variables can only be used in online mode. This mechanism will therefore not

work in the CNC editor. Instead, you can proceed as follows:
If no variable is specified in O, an implicit decoder variable (type: INT) is used. This

mechanism also works offline in the editor. However, please note that as it only makes one

variable available, nested jumps and loops cannot be programmed.
Example:

N1000 G36 O$g_i$ D5

N1000 G36 O$g_i$ D5
N1010 G1 X100 F100 E100 E-100
N1020 G1 X0
N1030 G37 O$g_i$ D-1
N1040 G20 L1010 K$g_i$

N1000 G36 D5
N1010 G1 X100 F100 E100 E-100
N1020 G1 X0
N1030 G37 D-1
N1040 G20 L1010

Advertising