Variables
In the RS274/NGC language view, a machining control center maintains an array of 5999 numerical variables. They can be accessed by #1 .. #5999. The specific variables with dedicated functions are listed in the table below. Other variables in the range of 1..5999 are free to use in your G-Code program. Some of them have a special function and are read-only, see the table below.
A simple example of usage:
Parameters with specific meanings are listed in the table below.
Number | Access | Parameter |
1-26 | Read-Only | Used for parameters when overriding m-functions. When in the g-code there is e.g. M999 X100 S1000 And you have in your macro.cnc: Sub m999 msg “this is my m999 X=”#24” S=”#19 Endsub Inside the subroutine, the given X and S parameters are at #24 and #19 #1-#26 = A – Z parameter value. Values are negative -1e10 if not provided with m999 in this example. |
27-4999 | Read-Write | Free to use, note that 4995 – 4999 are used by the tool length measurement function under user button 2. Z#4995 is used for the tool setter height for zeroing Z under user button 1. Z#4996 safe height for tool measurement above the fixed tool setter. x#4997 y#4998 fixed tool setter position. z#4999 chuck height, or zero length tool height, chuck just touches the fixed tool setter at this height. |
4000-4999 | Read-Only | Free to use, persistent, see above some of these are used by tool length measurement and zeroing. |
5001-5006 | Read-Only | POS X – C, interpreter position = work position |
5008 | Read-Only | Actual TOOL # |
5009 | Read-Only | Actual TOOL Radius |
5010 | Read-Only | Actual TOOL Z offset (Length + zDelta) |
5011 | Read-Only | New tool during tool change |
5012 | Read-Only | Actual tool X offset (X offset + X delta) |
5013 | Read-Only | Actual G43 Z offset (Z offset + zDelta) |
5014 | Read-Only | Actual G43 X offset (X offset + xDelta) |
5015 - 5050 | Read-Write | Used in tool change subroutine |
5051 - 5056 | Read-Only | Probe position X – C in machine coordinates |
5061 - 5066 | Read-Only | Probe position X – C in work coordinates |
5067 | Read-Only | 1 if the probe is triggered after G38.2, 0 otherwise. |
5068 | Read-Only | Actual Probe value |
5069 | Read-Only | Hand-wheel counter. |
5070 | Read-Only | Spindle rate in rev/second |
5071-5076 | Read-Only | POS X – C, interpreter position without offsets = Machine position. |
5081-5086 | Read-Only | Probe position X – C in joint coordinates |
5101-5106 | Read-Only | MCA NEG LIMIT X - C |
5111-5116 | Read-Only | MCA POS LIMIT X - C |
5121-5126 | Read-Only | HOME X-C |
5131-5133 | Read-Only | TCA NEG LIMIT X-Z |
5141-5143 | Read-Only | TCA POS LIMIT X-Z |
5150 | Read-Only | Active kin type: 1: Trivial 2: 4_AX_ACYLINDER (Y -> A mapping) 3: Virtual C 4-17 : System reserved 18-30: Custom 1 – Custom 12 |
5151 | Read-Only | ZHC is active |
5152 | Read-Only | 1: Spindle is ON, 0:Spindle = OFF |
5161 - 5166 | Read-Only | G28 home X - C |
5181 - 5186 | Read-Only | G30 home X - C |
5190 | Read-Only | G68 Rotation Method (0=OFF, 1=ON) |
5191 | Read-Only | G68/G51 Rotation point X |
5192 | Read-Only | G68/G51 Rotation point Y |
5193 | Read-Only | G68/G51 Rotation point Z |
5194 | Read-Only | G68 Rotation angle XY |
5195 | Read-Only | G68 Rotation angle YZ |
5196 | Read-Only | G68 Rotation angle XZ |
G5200 | Read-Only | G51 Scaling (0=OFF, 1 = ON) |
G5204 | Read-Only | G51 Scaling factor X |
G5205 | Read-Only | G51 Scaling factor Y |
G5206 | Read-Only | G51 Scaling factor Z (1.0 always) |
5211 - 5216 | Read-Write | G92 offset X - C |
5220 | Read-Write | Coord. System number |
5221 - 5226 | Read-Write | Coord. System 1 X – C |
5241 - 5246 | Read-Write | Coord. System 2 X – C |
5261 - 5266 | Read-Write | Coord. System 3 X – C |
5281 - 5286 | Read-Write | Coord. System 4 X – C |
5301 - 5306 | Read-Write | Coord. System 5 X – C |
5321 - 5326 | Read-Write | Coord. System 6 X – C |
5341 - 5346 | Read-Write | Coord. System 7 X – C |
5361 - 5366 | Read-Write | Coord. System 8 X – C |
5381 - 5386 | Read-Write | Coord. System 9 X – C |
5390 | Read-Only | Spindle selection 0=M90 1=M91 2=M92 |
5391 - 5393 | Read-Only | Alt spindle Offset X - Z |
5394 - 5397 | Read-Only | Spindle Speed MAX M90-M93 |
5230 | Read-Write | Reserved for rotation coordinate system 1 |
5250 | Read-Write | Reserved for rotation coordinate system 2 |
5270 | Read-Write | Reserved for rotation coordinate system 3 |
5290 | Read-Write | Reserved for rotation coordinate system 4 |
5310 | Read-Write | Reserved for rotation coordinate system 5 |
5330 | Read-Write | Reserved for rotation coordinate system 6 |
5350 | Read-Write | Reserved for rotation coordinate system 7 |
5370 | Read-Write | Reserved for rotation coordinate system 8 |
5380 | Read-Only | Simulation mode 0=normal 1=Simulation. |
5397 | Read-Only | Running mode 0=normal 1=rendering Use e.g. if you have G38.2 movements in your macro file because during rendering G38.2 always runs until the given end point which may give incorrect tool measurement results. Always take care that the tool table contains (approx.) correct tool data |
5398 | Read-Only | Return value for dlgmsg (+1 OK, -1 Cancel) |
5399 | Read-Only | Return value for M55, M56 |
5401 – 5499 | Read-Write | Tool z offset (Length) Tool 1 – Tool 99 |
5501 – 5599 | Read-Write | Tool diameter Tool 1 – Tool 99 |
5601 – 5699 | Read-Write | Tool x offset (for Turning) Tool 1 – Tool 99 |
5701 – 5799 | Read-Write | Tool orientation (for Turning) Tool 1 – Tool 99 |
| | (Currently supported only Tool 0 .. Tool 99) |
5801 - 5899 | Read-Write | Tool X Delta due to Wear |
5901 - 5999 | Read-Write | Tool Z Delta due to Wear |