G-code
Language standard

System parameters/Variables

1min

In the RS274/NGC language view, a machining center maintains 5999 numerical parameters. They can be accessed by #1 .. #5999. The specific parameters with a dedicated function are listed in the table below. Other parameters 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:

*parameters in italics are read-only

Parameter Number

Purpose

1 - 26*

Used for parameters when overriding m-functions.

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

Free to use, note that 4995 – 4999 are used by the tool length measurement function under user button 2.

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. Z#4995 is used for the tool setter height for zeroing Z under user button 1.

4000 - 4999

Free to use, persistent, see above some of these are used by tool length measurement and zeroing.

5001 - 5006*

Position of X – C, interpreter position = work position

5008*

Current tool number

5009*

Current tool radius

5010*

Current tool Z offset (length + zDelta)

5011*

New tool number during tool change (M6)

5012*

Current tool X offset (X offset + xDelta)

5013*

Current G43 Z offset (Z offset + zDelta)

5014*

Current G43 X offset (X offset + xDelta)

5015 - 5050

Used in tool change sub routine

5051 - 5056*

Probe position X - C in machine coordinates

5061 - 5066*

Probe position X - C in work coordinates

5067*

1 if the probe is triggered after G38.2, 0 otherwise

5068*

Current probe value

5069*

Handwheel counter

5070*

Spindle rate in rev/second

5071 - 5076*

Position of X - C, interpreter position without offsets = machine position

5081 - 5086*

Probe position X - C in joint coordinates

5101 - 5106*

MCA negative limit X - C

5111 - 5116*

MCA positive limit X - C

5121 - 5126*

Home position X - C

5131 - 5133*

TCA negative limit X - Z

5141 - 5143*

TCA positive limit X - Z

5150*

Active kinematics type:

1: Trivial 2: 4_AX_ACYLINDER (Y -> A mapping) 3: Virtual C 4 - 17: System reserved 18 - 30: Custom 1 – Custom 12

5151*

ZHC is active

5152*

1 if the spindle is on, 0 if the spindle is off.

5161 - 5166*

G28 home X - C

5181 - 5186*

G30 home X - C

5190*

G68 rotation method (0 = off, 1 = on)

5191 - 5193*

G68/G51 rotation point X - C

5194*

G68 rotation angle XY

5195*

G68 rotation angle YZ

5196*

G68 rotation angle XZ

5200*

0 if G51 scaling is off, 1 if G51 scaling is on

5204*

G51 scaling factor X

5205*

G51 scaling factor Y

5206*

G51 scaling factor Z (always 1.0)

5211 - 5216

G92 offset X - C

5220

Coordinate system number

5221 - 5226

Coordinate system 1 X - C

5241 - 5246

Coordinate system 2 X - C

5261 - 5266

Coordinate system 3 X - C

5281 - 5286

Coordinate system 4 X - C

5301 - 5306

Coordinate system 5 X - C

5321 - 5326

Coordinate system 6 X - C

5341 - 5346

Coordinate system 7 X - C

5361 - 5366

Coordinate system 8 X - C

5381 - 5386

Coordinate system 9 X - C

5390*

Spindle selection 0 = M90, 1 = M91, 2 = M92

5391 - 5393*

Alternative spindle offset X- Z

5394 - 5397*

Spindle speed max M90 - M93

5230, 5250, 5270, 5290, 5310, 5330, 5350, 5370

Reserved for rotation coordinate system

5380*

Simulation mode, 0: controller connected, 1: simulation mode

5397*

Running mode, 0: running, 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*

Return value of dlgmsg (1 = OK, -1 = Cancel)

5399*

Return value for M55, M56

5401 - 5499

Tool Z offset (length) for tools 1 - 99

5501 - 5599

Tool diameter for tools 1 - 99

5601 - 5699

Tool X offset (for lathe) for tools 1 - 99

5701 - 5799

Tool orientation (for turning) for tools 1 - 99

5801 - 5899

Tool X delta due to wear

5901 - 5999

Tool Z delta due to wear

ο»Ώ