SINUMERIK System Variables Quick Reference: $M/$S/$T/$P/$A/$V/$R Prefixes, One $ or Two, and Common Variables

When you write 828D/840D sl macros, cycles or PLC interfaces, the blocker is rarely the logic – it is "how do I spell this variable?" SINUMERIK variable names are a readable encoding: $ + data-class letter + scope letter + underscore + name. Learn the scheme and thousands of variables become self-explanatory. This article covers the prefix system, the preprocessing-versus-main-run difference behind one or two dollar signs, a working list of common variables, and three mistakes that copy-paste checklists keep repeating.

Sources: the Siemens official Job Planning / Programming Manual prefix-system table ($$M/$$S and main-run variables), the 828D/840D sl System Variables List Manual for common variables, and CNC4YOU published examples. Use the manual for your exact control version – variable sets and access rights differ across 828D / 840D sl / ONE.

41.1 First letter equals data class

The letter after $ says what kind of data it is – this is the key to the whole system:

PrefixData classRead/write contextFanuc analogy
$MMachine data (configuration, protected)preprocessingparameters
$SSetting data, protection zonespreprocessingsettings
$TTool management datapreprocessing#2001+ offsets
$PProgrammed values (evaluated at preprocessing)preprocessingmodal #4001+
$CCycle variables of ISO envelope cyclespreprocessing–
$OOption datapreprocessing–
RR-parameters (arithmetic)preprocessing (no prefix in part program)#100 series
$$M / $$SMachine / setting data, main-run formmain run–
$ACurrent main-run data (actual values)main run#3000-#5000 reads
$VServo data (e.g. raw encoder actual values)main rundiagnostic screens
$RR-parameter (synchronized-action form)main run–
广告

So $AA_IM[X] decodes as $A (current actual value) + A (axis-specific) + IM (position in Machine coordinates) + [X axis]. Once you can split that string, most variables read themselves.

SINUMERIK system variable prefix decoding

41.2 Second letter equals visibility: N global / C channel / A axis

The second letter says where the variable is visible:

LetterMeaningExamples
NNCK-global (whole control)$MN_, $SN_, $AN_
CChannel-specific$MC_, $SC_, $AC_, $TC_
AAxis-specific (needs an [axis] index)$MA_, $SA_, $AA_, $VA_

Two exceptions to memorise:

  • $TC_: here the second letter C does not mean channel – it means tool-carrier-specific (TC = Tool Carrier). $TC_DP3[T,D] is the length-1 geometry of tool T, edge D, not a channel variable.
  • $P_: the whole $P_ family is channel-specific and does not follow the second-letter rule.

A few variables carry no scope letter, e.g. $A_YEAR, $A_MONTH (global runtime data).

Variable visibility: N global, C channel, A axis

41.3 One $ or two $: preprocessing versus main run

This is the layer people mix up. The manual divides variables by when they are read and written:

  • Preprocessing variables are read/written when the block is interpreted (decoded); they do not trigger a preprocessing stop. $M/$S/$T/$P/$C/$O and R-parameters in a part program belong here.
  • Main-run variables are read/written when the block is executed: variables programmable in synchronized actions, variables in a part program whose access triggers a preprocessing stop, and variables calculated during preprocessing but written only in the main run. $A/$V, $$M/$$S and $R belong here.

Three hard rules follow:

  1. Machine/setting data: in a part program or cycle as a preprocessing variable, write one $ (e.g. $MA_...); in a synchronized action, to read/write synchronously with the main run, write two $$ (e.g. $$SA_OSCILL_REVERSE_POS2[Z]). A value that changes during machining must use two $ for main-run synchronisation.
  2. R-parameters: in a part program/cycle write R10 (no prefix); in a synchronized action write $R10 (one $).
  3. $A / $V take one $ but are main-run variables – do not apply the “one dollar means preprocessing” slogan; look at the first letter, not the count.

Reading an $A.../$V... runtime variable in a part program forces an implicit preprocessing stop (similar to STOPRE) so the value is current – expect a brief pause in look-ahead; do not read them casually in a smooth finishing block.

Synchronized-action example from the manual:

ID=1 WHENEVER $AA_IM[Z] < $$SA_OSCILL_REVERSE_POS2[Z] - 6 DO $AA_OVR[X]=0

Here $AA_IM[Z] is a main-run actual value and $$SA_... is setting data read synchronously with the main run; if that setting data does not change during machining, one $ (preprocessing read) is enough.

One $ or two $: preprocessing versus main run

41.4 R-parameters and user variables LUD/GUD/PUD

R-parameters are the scratchpad of macro programming: R0–R99 (count set by MD28050 $MC_MM_NUM_R_PARAM), channel-specific REAL, retentive across power-off and included in data backups; there is also a cross-channel global flavour RG[n]. Indirect addressing R[R2], expression indices and direct use in motion blocks (X=R1 Y=-R2 F500) are supported. Unlike Fanuc’s volatile #100 series, R-parameters behave more like the retentive #500s.

User-defined variables split by scope:

  • LUD (local user data): defined in the program with DEF INT / DEF REAL, valid only there.
  • GUD (global user data): declared in a GUD definition file, e.g. DEF NCK REAL PROBE_DIA (control-wide) or DEF CHAN INT FIXTURE_ID (per channel). Counts come from machine data such as $MN_MM_NUM_GUD_MODULES; synchronized actions have a built-in GUD2 block SYG_RM[n]/SYG_IM[n]/SYG_BM[n].
  • PUD (program-global user data): program-level globals, between LUD and GUD.

Red lines for writing: MD/SD can be written from a program/cycle only with the right access level and an IMMEDIATE activation setting; read-only variables (e.g. $AA_IM) cannot be written; writable values such as $P_UIFR take effect only after the coordinate system is re-selected.

41.5 Common variables you actually use

The most-used set on 828D/840D sl:

VariableMeaningAccess
$AA_IM[axis]Current position in machine coordinates (MCS)read-only
$AA_IW[axis]Current position in workpiece coordinates (WCS)read-only
$AA_MM[axis] / $AA_MW[axis]Probe trigger position (MCS / WCS)read-only
$VA_IM[axis]Encoder actual value (MCS)read-only
$P_EP[axis]Programmed end point of the current blockread-only
$P_GG[n]Active G function of G group n (n=6 plane, n=8 zero-offset group)read-only
$P_UIFRNUMNumber of the active settable frame (G500=0, G54=1, G55=2…)read-only
$P_UIFR[n,axis,TR]Translation of settable frame n (G54 = $P_UIFR[1])read/write
$P_IFRAME / $P_ACTFRAMEActive frame / total active frameread-only
$AA_S[n]Current speed of spindle nread-only
$P_TOOLNO / $P_TOOLActive tool number / active cutting edgeread-only
$TC_DP3[T,D] / $TC_DP6[T,D]Tool T edge D length-1 / radius geometryread/write
$AC_OPERATING_TIME / $AC_CUTTING_TIMETotal AUTO / cutting timeread-only

Three high-frequency errors that shop-floor checklists keep repeating:

  1. “$P_GG is the current work-zero number” – wrong. $P_GG[n] returns the active G function of a G group (n=6 gives the machining plane G17/G18/G19; n=8 relates to the zero-offset group). The active settable frame number is $P_UIFRNUM: 0 for G500, 1 for G54, 2 for G55.
  2. “$AA_ACT is the actual position” – not standard. Axis actual positions are $AA_IM (machine coordinates) or $AA_IW (workpiece coordinates); raw encoder values are $VA_IM.
  3. “$MM / $VN are machine data / servo” – non-standard spelling. Machine data is written by scope as $MN_/$MC_/$MA_, setting data as $SN_/$SC_/$SA_, and servo data belongs to the $V_ family (e.g. $VA_IM).
广告
Common system variables and three corrections

41.6 Case one: test the active work coordinate system in a macro

To run a segment only under G54, read $P_UIFRNUM:

IF $P_UIFRNUM <> 1 GOTOF WRONG_WCS   ; 1 = G54
; ... normal machining ...
M17
WRONG_WCS:
MSG("SELECT G54 BEFORE RUN")
M0
M17

Using $P_GG[8] instead reads modal information about G group 8 (zero offsets), which is a different semantic from the frame number, and descriptions of its exact return value differ between sources – use $P_UIFRNUM to identify the active frame; that is the variable supported consistently by the manual and CNC4YOU examples.

Shifting the G54 Z zero from inside a program (the equivalent of writing Fanuc #5223):

$P_UIFR[1,Z,TR] = $P_UIFR[1,Z,TR] - 0.05
G54    ; re-select to activate the change

41.7 Case two: compare spindle speed in a synchronized action

Read the actual spindle speed $AA_S[n] in a synchronized action and change the override:

ID=1 WHENEVER $AA_S[1] > 8000 DO $AC_OVR=50

Key points: synchronized actions read main-run values, so use the $AA_ family (one $, main run); if you also read MD/SD that changes during machining, use $$ for main-run synchronous reads. Writing MD/SD needs the access level and IMMEDIATE setting. The properties of each system variable (read/write, preprocessing/main run) are listed in the System Variables List Manual.

41.8 Comparison with Fanuc macro variables #1-#999

PurposeSINUMERIKFanuc Macro B
Free calculation variableR0-R99 (retentive)#100-#199 (volatile) / #500-#999 (retentive)
Current X work coordinate$AA_IW[X]#5041
Current X machine coordinate$AA_IM[X]#5021
Active tool number$P_TOOLNO#4120
G54 X zero offset$P_UIFR[1,X,TR]#5221
Modal G function group$P_GG[n]#4001-#4022
Tool length geometry$TC_DP3[T,D]#2001+

$$ is not the same thing as a Fanuc # variable: $$ only means “the same variable written in the main-run context”, not a separate class of variables. Fanuc # numbers are address partitions (#100 common, #500 retentive, #3000 alarms, etc.). The two models differ – SINUMERIK is naming-based (class + scope + name), Fanuc is number-based partitions. See Fanuc Macro B variable partitions.

41.9 Where the other quick references fit

System variables and machine data are two layers: MD/SD are the parameter values, system variables are the names you use to read those values and states. For MD number ranges see 828D common MD quick reference; for SD versus MD see Setting data vs machine data; for the tool-management DB interface see Tool management DB quick reference.

This article is a starter list, not the full variable set – consult the System Variables List Manual for your control version for the complete collection, properties and access rights.

Frequently Asked Questions

What do the first and second letters of a system-variable prefix mean?

The first letter is the data class: $M machine data, $S setting data, $T tool management, $P programmed values, $A current actual values, $V servo data, R/$R arithmetic parameters, $C ISO cycles, $O option data. The second letter is visibility: N is NCK-global, C is channel-specific and A is axis-specific (takes an [axis] index). Two exceptions: the C in $TC_ means tool-carrier-specific, and the whole $P_ family is channel-specific.

Why is the same variable written with one dollar sign sometimes and two other times?

Because the read/write context differs. Machine/setting data uses one $ as a preprocessing variable in a part program and two $$ for main-run synchronous access in synchronized actions (a value that changes during machining must use two). R-parameters are written R10 with no prefix in a part program and $R10 in synchronized actions. Note that $A/$V take one $ but are main-run variables – the first letter decides, not the dollar count. Reading $A… in a part program forces an implicit preprocessing stop.

How do I read which work coordinate system is active, G54 or G55, from a macro?

Use $P_UIFRNUM: 0 for G500, 1 for G54, 2 for G55, and so on. IF $P_UIFRNUM <> 1 GOTOF ... tests for G54. Do not use $P_GG[n] – that is the active G function of G group n (for n=8, the modal zero-offset selection), not the active settable frame number.

Last updated: 2026-11-24

Where to go next

Read the guide, get the right instrument, or walk the diagnosis through with someone — pick whichever you need.

Also available in Chinese: SINUMERIK 系统变量速查:$M/$S/$T/$P/$A/$V/$R 前缀怎么读 + 一个 $ 还是两个 $ + 常用变量实操($P_GG / $AA_IM / $P_UIFR)
The original Chinese version — same procedure, with the full field notes.
© 版权声明
THE END
喜欢就支持一下吧
点赞12赞赏 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容

CNC电气调试问题解答 | 数控机床电气工程师资料共享屋
CNC电气调试问题解答 | 数控机床电气工程师资料共享屋
CNC电气调试问题解答 | 数控机床电气工程师资料共享屋
CNC电气调试问题解答 | 数控机床电气工程师资料共享屋
CNC电气调试问题解答 | 数控机床电气工程师资料共享屋
CNC电气调试问题解答 | 数控机床电气工程师资料共享屋
图片-CNCShare | 数控电气技术中心
图片-CNCShare | 数控电气技术中心
图片-CNCShare | 数控电气技术中心
图片-CNCShare | 数控电气技术中心
图片-CNCShare | 数控电气技术中心
图片-CNCShare | 数控电气技术中心
FANUC Touchscreen / Display Unit Black or Flickering? A02B / A61L Part Numbers, 8 Faults and Replacement Steps-CNCShare | 数控电气技术中心
FANUC 触摸屏/显示单元黑屏、花屏、触摸失灵怎么修?A02B / A61L 件号怎么读 + 8 类故障速判 + 更换实操-CNCShare | 数控电气技术中心
海德汉 TNC 编程站(Programming Station)哪里下载?官方入口、版本对应、数字孪生与迁移到机床的完整流程-CNCShare | 数控电气技术中心
Fanuc G54.1 Additional Work Coordinates: P1-P48 / P1-P300, G10 L20, G52 and the Three PS0030 Boundaries-CNCShare | 数控电气技术中心
FANUC G54.1 附加工件坐标系怎么用?P1–P48 / P1–P300、G10 L20、G52 与 PS0030 三条边界-CNCShare | 数控电气技术中心
Fanuc Wire EDM / Sinker EDM: A-1ic Reverse Alarm Is Not Cutter Comp, and 317 Is an APC Battery-CNCShare | 数控电气技术中心
FANUC 线切割 / 电火花专机怎么修?A-1ic 反向报警真因不是刀补,317 是 APC 电池,接地门槛别照抄-CNCShare | 数控电气技术中心
Fanuc 16A/16B/18A/18B Legacy Machines: Alpha SVM/SPM Alarms and Obsolete Spare Strategy-CNCShare | 数控电气技术中心
FANUC 16A/16B/18A/18B 老系统伺服报警怎么查?Alpha 时代 SVM/SPM 放大器、报警对照与停产备件替代思路-CNCShare | 数控电气技术中心
Fanuc P/S Alarm 5560 and Beyond: PS5560, the 45xx Macro Family and the Official PS5523 Route-CNCShare | 数控电气技术中心
FANUC P/S 报警 5560 以后怎么查?中文补齐:PS5560 两种现场文本、45xx 宏调用族、PS5523 官方上报路径-CNCShare | 数控电气技术中心
Fanuc Tool Breakage Detection Without Extra Hardware: Spindle Load via PMC Window Function 153-CNCShare | 数控电气技术中心
文章精选
专心做好一件事
打造更优雅的WordPress主题-CNCShare | 数控电气技术中心
专心做好一件事
打造更优雅的WordPress主题