SINUMERIK Synchronized Actions

A part program runs block by block through the preprocessor: read a block, plan it, hand it to the interpolator, move on. That is too slow and too coarse for reactions that must happen now — stop an axis when a load sensor spikes, correct a tool the instant a probe fires, disable read-in until a PLC input goes high. Synchronized actions are the 840D sl / SINUMERIK ONE answer: a statement you write once in the program that the control then evaluates and executes cyclically in the interpolator clock cycle, synchronous to the machining blocks and completely independent of block boundaries.

Why They Exist — Real-Time vs. Part-Program Flow

In normal flow, an IF in the part program is evaluated once, during preprocessing, long before the tool reaches the block. A synchronized action is different: the control re-checks its condition every interpolator clock cycle (typically a few milliseconds) while machining continues, and fires the action the moment the condition is met — mid-block if need be. That is what makes them the right tool for reactions that cannot wait for the next block:

Use caseWhat the synchronized action does
Adaptive controlVary feed or override from a drive-load or sensor signal, continuously (SYNFCT)
Monitoring / interlockWatch an axis distance or input every cycle and brake, stop, or retract on violation
MeasurementCyclic / continuous probing (MEAC, MEAWA) that captures values in the main run
Clearance / gap controlOverlay an axis position ($AA_OFF) from an analog sensor input
PLC-triggered motionPosition a command axis or spindle when the PLC sets a data bit ($A_DBB)
Fast auxiliary outputOutput an M/S/H function to the PLC in the exact cycle a condition becomes true

The manual is explicit about the boundaries. Permitted actions include: output of M/S/H auxiliary functions, reading/writing main-run variables, traversing positioning (command) axes, the synchronous procedures (read-in disable, delete distance-to-go, cancel preprocessing stop), technology cycles, function evaluation, tool offsets, couplings, and measurement. The one flatly non-permitted action is traversing path axes — path motion belongs to the part program, not a synchronized action.

Anatomy of a Synchronized Action

A synchronized action occupies its own part-program block — no other commands may share that block. The full form is four optional prefixes in front of the obligatory action part:

[ ID=n | IDS=n ]  [ WHENEVER|FROM|WHEN|EVERY ]  [ G70/G71/G700/G710 ]  <condition>  DO <action 1> ... <action n>  [ ELSE <action> ... ]
\______validity_____/    \_______frequency________/    \____G command____/   \_truth expr_/       \_____fires when true_____/        \__fires when false__/

The shortest legal form is just DO <action> (no condition → the action runs every interpolator cycle). Everything else layers on top. If several actions follow one DO, they all execute in the same interpolator cycle.

Validity / lifetime — the ID prefix

PrefixTypeLives
(none)Non-modalOnly while the following main-run block is active; AUTOMATIC mode only
ID=nModalFrom this block until part-program end; AUTOMATIC mode only
IDS=nStaticIn all operating modes, for an unlimited period (survives program end/reset)

Static synchronized actions are typically defined in an ASUB and activated from the PLC user program, so they run regardless of what the channel is doing. The identification number n matters: within a channel, actions with the same ID/IDS replace each other, and different IDs run in parallel. Modal/static actions execute in ascending ID order; non-modal ones run after the modal ones, in programming order. Number ranges are reserved:

ID / IDS rangeReserved for
1 ... 999General area (your programs) — any directory
1000 ... 1199Safety Integrated function (/_N_CST_DIR/_N_SAFE_SPF)
1200 ... 1399Machine manufacturer (/_N_CMA_DIR) and Siemens (/_N_CST_DIR)

Only IDs 1 ... 64 can be locked/coordinated from the PLC over the NC/PLC interface. Ranges can also be write-protected against CANCEL/LOCK via machine data $MN_PREVENT_SYNACT_LOCK.

Frequency — how often the condition is checked and the action fires

KeywordMeaning
(none)No condition specified → action runs cyclically every interpolator cycle
WHENEVERWhile the condition is true, run the action every interpolator cycle (level-triggered, repeating)
WHENWhen the condition first becomes true, run the action once, then stop checking
EVERYRun the action once on every FALSE→TRUE transition (and once if already true at start) — edge-triggered
FROMOnce the condition has been fulfilled a single time, run the action every cycle for the rest of the action's life — even after the condition goes false again

Condition: any expression returning TRUE/FALSE — comparisons of system variables against constants, other variables, or arithmetic results, combined with Boolean operators. G command: the only G codes allowed in a synchronized action are the measuring-system codes G70/G71/G700/G710; programming one gives the action a defined inch/metric context regardless of what the part program is doing. ELSE: optional actions that fire when the condition is false, so a WHENEVER pair with opposite conditions collapses into one line.

Real-Time Variables You Use Inside Them

Synchronized-action variables are read and written in the main run (the exceptions — user variables LUD/GUD, machine data $M, setting data $S, and bare R-parameters Rn — are already evaluated during preprocessing). The $-prefix decode is the same one used everywhere on Sinumerik: $A_ current main-run data, $AA_ axis-specific runtime, $AC_ channel-specific runtime, $V_/$VA_ servo data, $P_ preprocessing (program-run) data. In the "System Variables" Parameter Manual, a variable usable here is flagged with an X in the "SA" column for Read and/or Write. The workhorses:

VariableWhat it isIn a sync. action
Digital / analog I/O and PLC
$A_IN[n] / $A_OUT[n]Digital NCK input / output nread / read+write
$A_INA[n] / $A_OUTA[n]Analog input / output n (e.g. 1000 ≈ 1 V)read / read+write
$A_DBB[n] / $A_DBW[n] / $A_DBD[n]PLC data byte / word / doubleword (NC↔PLC common data)read+write
Axis (index by axis name)
$AA_IM[ax] / $AA_IW[ax]Current position, machine (MCS) / workpiece (WCS)read
$VA_IM[ax]Actual (encoder) position, servo valueread
$AA_OVR[ax]Axial override [%]write
$AA_VC[ax]Additive axial feedrate overridewrite (via SYNFCT)
$AA_OFF[ax]Overlaid movement / position offset (in the BCS)write
$AA_TOFF[ax]Online tool length compensationwrite
$AA_LOAD[ax] / $AA_CURR[ax]Drive load [%] / drive actual currentread
$AA_DTEW[ax] / $AA_DELT[ax]Axial distance-to-go (WCS) / deleted distance-to-goread
$AA_STAT[ax]Axis status (e.g. 1 = axis stopped/in position)read
$AA_MW[ax] / $AA_MM[ax]Measured probe trigger position, WCS / MCSread
Channel
$AC_MARKER[n]Channel marker/counter array (INT) — sized by MD28256read+write
$AC_PARAM[n]Channel general-purpose buffer array (REAL) — sized by MD28254read+write
$AC_TIMER[n]Channel timer array (REAL, seconds); set >0 to start, <0 to stopread+write
$AC_OVRPath override [%]write
$AC_VCAdditive path feedrate overridewrite (via SYNFCT)
$AC_DTEB / $AC_DTEWPath distance-to-go, BCS / WCSread
$AC_TIME / $AC_TIMECTime from block start / counter reset on block changeread
$AC_PATHNNormalized path parameter (0 at block start … 1 at block end)read
$AC_FIFO1[n]$AC_FIFO10[n]FIFO variables for storing a stream of measured valuesread+write
$AC_SYNA_MEMFree synchronized-action elements remainingread
R-parameters, machine/setting data
$R[n] / $RnR-parameter as a main-run variable (the $ forces main-run access)read+write
$$M... / $$S...Machine / setting data that may change during the run (double $ = read/write in main run)read+write

Two notation rules bite people. First, R-parameters: written R10 they are preprocessing variables; written $R10 or $R[10] they are main-run variables — inside synchronized actions you almost always want the $ form. Second, machine/setting data: $SA_... reads a value assumed constant during the action (accessed at preprocessing); a leading double dollar $$SA_... forces the read/write into the main run, which you need whenever an operator or another process can change that datum while the action is live.

$AC_MARKER (INT) and $AC_PARAM (REAL) are the two scratch arrays purpose-built for coordinating logic between actions — think of them as the synchronized-action equivalent of R-parameters, but typed and channel-local. Implicit REAL↔INT↔BOOL conversion applies on assignment (REAL→INT rounds; any non-zero→BOOL TRUE). An array index may itself be a system variable (e.g. $AC_PARAM[$AC_MARKER[1]]), but indices may not be nested further and must not be formed from a preprocessing variable such as $P_EP.

Actions You Can Trigger

The action part after DO accepts a restricted vocabulary — a subset of NC language, not the whole thing. The most useful:

ActionEffect
Assignment & output
$Var = exprWrite any SA-writable system variable, marker, param, R-param, or I/O
M… S… H…Output auxiliary function to PLC, immediately in this cycle (max 5 M, 3 S, 3 H per action)
Axis & spindle motion (command axes only)
POS[ax]=… FA[ax]=…Position a command axis at axial feed FA; POSA = modal positioning
MOV[ax]=1 / =0Traverse axis endlessly in a direction / stop it
SPOS=…, M3/M4/M5Position or run a spindle (predefined M functions M3/M4/M5/M40–45/M70/M17 are the only ones allowed)
FXS[ax]=1, FXST, FXSWTravel to fixed stop, torque limit, monitoring window
Synchronous procedures
RDISABLERead-in disable — halt block processing while the condition holds (motion-sync actions continue)
STOPREOFCancel an active preprocessing stop (non-modal + WHEN only)
DELDTG / DELDTG(ax)Delete path / axial distance-to-go (non-modal only)
Functions, offsets, couplings, measurement
SYNFCT(poly,out,in)Evaluate a polynomial (defined by FCTDEF) → write result to a variable: the adaptive-control primitive
FTOC(…)Online tool fine compensation of a geometry axis from a reference value
LEADON/LEADOF, TRAILON/TRAILOF, CTAB…Activate/deactivate master-value couplings, coupled motion, curve tables
MEAWA, MEACAxial measurement without delete-distance-to-go / cyclic measurement
SETM/CLEARM, SETALChannel-coordination markers / set a user alarm
technology cycle nameCall a technology cycle (a subprogram of SA-legal commands; ICYCON/ICYCOF pick one-block-per-cycle vs. all-at-once)

Jump statements (IF, GOTOF, GOTOB) and program-end commands (M17, M30, RET) are not allowed in a plain synchronized action — they may only appear inside a technology cycle that the action calls. Likewise the absolute/incremental modal codes G90/G91 cannot be programmed; use the per-value forms AC(…), IC(…), DC(…) on a POS target instead.

Worked Examples (from the Function Manual)

Fire an auxiliary function and set a digital output the instant the Y axis reaches a machine position — both actions execute in the same interpolator cycle:

WHEN $AA_IM[Y] >= 35.7 DO M135 $A_OUT[1]=1

Set a channel marker on a position condition, and fold two opposite WHENEVERs into one line with ELSE (path override 100 % below X=100, 50 % at or above it):

WHEN $AA_IW[X] > 50 DO $AC_MARKER[0]=1          ; latch a flag when X passes 50 (WCS)

ID=101 WHENEVER $VA_IM[X] < 100 DO $AC_OVR=100 ELSE $AC_OVR=50

Command axis positioning. When PLC input 1 goes high, position the X axis to 150 at axial feed 200 — X becomes a "command axis" driven from the synchronized action, in parallel with whatever the part program's path axes are doing:

N10 G01 X100 Y200 F1000                          ; normal path motion
N20 ID=1 WHEN $A_IN[1]==1 DO POS[X]=150 FA[X]=200 ; static command-axis move
...
CANCEL(1)                                        ; drop the synchronized action

Adaptive feed control. Hold a process quantity measured on analog input 1 at 2 V by adding a feed override in the range ±100 mm/min. Define the transfer polynomial once with FCTDEF, then evaluate it every cycle with SYNFCT into the path (or axial) feed override:

FCTDEF(1, -100, 100, 200, -100, 0, 0)            ; f(x)=a0+a1x+a2x^2+a3x^3, clamped to [-100,100]
ID=2 DO SYNFCT(1, $AC_VC, $A_INA[1])             ; additive path-feed override from input 1
; or, for the axis feed:  ID=1 DO SYNFCT(1, $AA_VC[X], $A_INA[1])

Read-in disable from an input. Stall the program in the interpolator cycle as long as the voltage on analog input 2 is below 7 V; block processing resumes automatically when the condition clears:

WHENEVER $A_INA[2] < 7000 DO RDISABLE            ; 1000 counts ~ 1 V

Collision monitoring between two independent axes. X1 and X2 run separate loaders; keep a safety clearance. If it closes below 30 units, brake X2 (override 0); if it closes below a tighter 15-unit barrier, drive X1 to a safe position:

ID=1 WHENEVER $AA_IM[X2] - $AA_IM[X1] < 30 DO $AA_OVR[X2]=0   ; safety barrier -> stop X2
ID=2 EVERY    $AA_IM[X2] - $AA_IM[X1] < 15 DO POS[X1]=0       ; inner barrier -> retract X1

PLC-driven spindle positioning via a technology cycle. Static actions watch PLC data bytes; when the PLC sets one, the action calls a technology cycle that positions the spindle to a value the PLC stored in $A_DBW[1]:

; in the main program:
IDS=1 EVERY $A_DBB[0]==1 DO NULL_POS             ; PLC requests basic position
IDS=2 EVERY $A_DBB[1]==1 DO ZIEL_POS            ; PLC requests target position

; technology cycle ZIEL_POS (%_N_ZIEL_POS_SPF):
PROC ZIEL_POS
SPOS=IC($A_DBW[1])                               ; incremental spindle move to PLC value
$A_DBB[1]=0                                       ; acknowledge back to PLC
RET

Coordinating & Cancelling — LOCK / UNLOCK / CANCEL

Every modal (ID=) or static (IDS=) action carries a unique number you can act on later, from the part program or from another synchronized action:

CommandEffect on the action with that IDAn active positioning move…
LOCK(n)Lock (suspend) it…is interrupted
UNLOCK(n)Resume a locked action…is continued
CANCEL(n)Delete it permanently…is terminated

The same actions in the ID range 1 ... 64 can be locked from the PLC over the NC/PLC interface (DB21 DBX300.0…307.7), or all channel actions at once (DB21 DBX1.2). Ranges reserved by the machine manufacturer can be protected against CANCEL/LOCK entirely through MD11500 $MN_PREVENT_SYNACT_LOCK / MD21240.

Gotchas

  • Only a subset of the language is legal after DO. No path-axis motion, no G90/G91, no IF/GOTO/program-end — those live only inside a called technology cycle. Couplings marked "currently not available in synchronized actions" (e.g. CPLA, CPRES) will be rejected.
  • Frequency changes semantics. A non-modal action can only output M/S/H auxiliary functions in combination with WHEN or EVERY. STOPREOF is non-modal + WHEN only. DELDTG and PRESETON are non-modal only.
  • The $ and $$ prefixes are not cosmetic. Bare Rn, $M..., $S... are read at preprocessing; $Rn, $$M..., $$S... are read in the main run. Use the wrong one and the value is stale (or updates never reach the action).
  • Same ID overwrites; parallel needs distinct IDs. Two active actions sharing an ID in a channel replace each other — a silent way to lose a monitor you thought was running.
  • Interpolator-cycle budget is finite. Each action consumes synchronized-action elements (MD28250 $MC_MM_NUM_SYNC_ELEMENTS); read $AC_SYNA_MEM for the remainder. Overrun raises alarm 14751 "Resources for motion synchronous actions not sufficient." Many simultaneously active actions may force a longer interpolator clock cycle (MD10070).
  • ID ranges are reserved. Stay in 1 ... 999 for your own work; 1000 ... 1399 belong to Safety Integrated, the machine manufacturer, and Siemens.
  • Command axes vs. path axes. An axis first moved by a synchronized action (command axis) then moved by the part program forces an implicit preprocessing stop with reorganization (STOPRE) — and RDISABLE in the presence of an axis exchange acts on the internally generated REPOSA block, not the block you expect. Give a defined measuring system (G70/G71/G700/G710) so position values evaluate predictably.

References

  • Siemens, SINUMERIK 840D sl / 840DE sl Synchronized Actions Function Manual, 06/2019, A5E400874176B AC (CNC software 4.92).
  • Siemens, SINUMERIK System Variables Parameter Manual — the "SA" column marks which variables are readable/writable in synchronized actions.
  • Siemens, SINUMERIK Programming Manual, Job Planning — full descriptions of the language elements (couplings, measurement, FCTDEF) referenced above.

Have a question or want to contribute?

Contact us with corrections, additions, or topics you'd like covered.

Get in Touch