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:
| Prefix | Data class | Read/write context | Fanuc analogy |
|---|---|---|---|
| $M | Machine data (configuration, protected) | preprocessing | parameters |
| $S | Setting data, protection zones | preprocessing | settings |
| $T | Tool management data | preprocessing | #2001+ offsets |
| $P | Programmed values (evaluated at preprocessing) | preprocessing | modal #4001+ |
| $C | Cycle variables of ISO envelope cycles | preprocessing | – |
| $O | Option data | preprocessing | – |
| R | R-parameters (arithmetic) | preprocessing (no prefix in part program) | #100 series |
| $$M / $$S | Machine / setting data, main-run form | main run | – |
| $A | Current main-run data (actual values) | main run | #3000-#5000 reads |
| $V | Servo data (e.g. raw encoder actual values) | main run | diagnostic screens |
| $R | R-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.

41.2 Second letter equals visibility: N global / C channel / A axis
The second letter says where the variable is visible:
| Letter | Meaning | Examples |
|---|---|---|
| N | NCK-global (whole control) | $MN_, $SN_, $AN_ |
| C | Channel-specific | $MC_, $SC_, $AC_, $TC_ |
| A | Axis-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).

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:
- 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. - R-parameters: in a part program/cycle write
R10(no prefix); in a synchronized action write$R10(one$). - $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.

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) orDEF 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 blockSYG_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:
| Variable | Meaning | Access |
|---|---|---|
| $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 block | read-only |
| $P_GG[n] | Active G function of G group n (n=6 plane, n=8 zero-offset group) | read-only |
| $P_UIFRNUM | Number 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_ACTFRAME | Active frame / total active frame | read-only |
| $AA_S[n] | Current speed of spindle n | read-only |
| $P_TOOLNO / $P_TOOL | Active tool number / active cutting edge | read-only |
| $TC_DP3[T,D] / $TC_DP6[T,D] | Tool T edge D length-1 / radius geometry | read/write |
| $AC_OPERATING_TIME / $AC_CUTTING_TIME | Total AUTO / cutting time | read-only |
Three high-frequency errors that shop-floor checklists keep repeating:
- “$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.
- “$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.
- “$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).

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
| Purpose | SINUMERIK | Fanuc Macro B |
|---|---|---|
| Free calculation variable | R0-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
- FANUC Troubleshooting — the full guide library: alarms, diagnosis numbers, servo, spindle, PMC and electrical faults, organised by symptom.
- CNC Repair Tools — which instrument measures what: multimeters, clamp meters, insulation testers and oscilloscopes, with the specification that actually matters.
- Remote Technical Support — have the readings reviewed with you: alarm reverse lookup, PMC ladder analysis and servo tuning advice by call. Repair companies and integrators welcome.
- Buying & Ownership Decisions — refurbished vs new, used-machine checks, software licensing and manuals: spend with the field facts in hand.
Read the guide, get the right instrument, or walk the diagnosis through with someone — pick whichever you need.
The original Chinese version — same procedure, with the full field notes.













































暂无评论内容