Outputting Sinumerik 840D Axis Torque via Profibus Analog Output

David Krause12 min read
Motion ControlSiemensTutorial / How-to
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Overview

On a SINUMERIK 840D control, axis-internal drive quantities such as torque ($AA_TORQUE), current ($AA_CURR), power ($AA_POWER) and load ($AA_LOAD) can be made available to external hardware through a Profibus-mounted analog output module. Two engineering paths exist, both supported from the NCK side and both delivering a continuous, cycle-accurate signal during the entire machining cycle:

  1. FAST DMP analog output with a synchronized action writing to the system variable $A_OUTA[n]. The signal path is NCK → DMP module → analog voltage, bypassing the PLC cycle.
  2. FB2 PLC function from the SINUMERIK 840D PLC Toolbox basic program, which transfers the NC variable into the PLC via NCVar selector, after which the value is written to the analog output image.

Both methods require the load/torque option bit (6FC5251-0AB17-0AA0) to be enabled and axis machine data MD 36730 to be configured. This article documents the configuration of each path, the option set-up, the NCVar selector wiring, and field-proven troubleshooting steps for FB2 when the read data appears as zero or uninitialized on the PLC side.

Engineering rule of thumb: if the analog value is required at NCK interpolation cycle (IPO cycle, typically 4–12 ms) and does not need to be processed by PLC logic, use the FAST DMP path. If the value must be scaled, alarmed, or interlaced with PLC logic, use the FB2 path with a tolerance that accounts for the PLC cycle (typically 10–40 ms).

Prerequisites

  • SINUMERIK 840D (or 840D sl) with NCK software version that supports $AA_TORQUE / $AA_LOAD / $AA_CURR / $AA_POWER.
  • Active software option 6FC5251-0AB17-0AA0 (axis load/torque reading option).
  • Configured analog output hardware on Profibus (DP slave) or FAST DMP module wired to NCK.
  • Configured Profibus network, GSD file imported into SINUMERIK hardware configuration.
  • PLC Toolbox basic program loaded into the PLC (S7-300/400) – required for FB2 path.
  • Axis machine data MD 36730 configured (see dedicated section below).

Method 1 — FAST DMP Analog Output with Synchronized Actions

The FAST DMP analog output module is mapped to the NCK-side system variable $A_OUTA[n]. Each index corresponds to a physical analog channel on the DMP hardware. The signal is driven directly by the NCK, so the latency between the underlying drive quantity and the analog voltage is one IPO cycle, irrespective of the PLC cycle.

Hardware Topology

Drive (611D/611U) X axis torque NCK (840D) $AA_TORQUE[X] FAST DMP Module $A_OUTA[1] ±10 V to scope DRIVE-CLiQ / PROFIBUS synchronized action analog voltage

Synchronized Action Syntax

Define a synchronized action in the part program or in a static synchronized-action block (e.g., DEF INT ... with SYNC) that writes the axis torque to the analog output every IPO cycle:

WHEN TRUE DO $A_OUTA[1] = $AA_TORQUE[X]

This keeps the analog channel 1 permanently bound to the X-axis torque throughout the machining cycle. To condition the output (e.g., scale the value, blank it during rapid, or invert it for a positive-going voltage):

WHEN TRUE DO $A_OUTA[1] = $AA_TORQUE[X] * 0.1 + 5.0

For a windowing mask that disables the output when the X axis is not moving:

WHEN $AA_IM[X] <> 0 DO $A_OUTA[1] = $AA_TORQUE[X]
WHEN $AA_IM[X] == 0 DO $A_OUTA[1] = 0

Use $A_OUTA[1]..$A_OUTA[8] (typical) depending on the DMP module slot count. The index n in $A_OUTA[n] corresponds to the physical channel ordering on the DMP hardware as configured in the SINUMERIK hardware configuration.

Cycle / timing: The synchronized action runs at the IPO cycle of the channel in which it is declared. For safety-critical monitoring, declare it in the IPO channel of the leading axis (default channel = 1). Do not write the value in an event-driven synchronized action that fires only on edge — the analog output will hold its last value between events.

Method 2 — FB2 PLC Function from PLC Toolbox

The PLC Toolbox basic program provides a set of function blocks (FB2/FB3/FB4/FB5) for bidirectional NC-variable access. FB2 reads a single NC variable from the NCK into the PLC using a pre-configured NCVar selector (typically DB120). The data lands in a PLC-side word/double-word where it can be scaled, monitored, and written to a Profibus analog output via standard S7 I/O image or an FB to a Profibus DP slave.

NCVar Selector DB Configuration

The NCVar selector DB (commonly DB120, but the index is configurable via PLC machine data) describes which NCK variable to read, its area code, axis index, and other parameters. Typical fields include:

Element Type Description Example for $AA_TORQUE[X]
NR INT Variable number (1..N) — index used by FB2 to look up this entry 1
LADDR WORD Logical address of NCK (default 0 for the local NCU) W#16#0
Area BYTE NCK area identifier (axis-specific block) B#16#20 (NCK axis area)
Unit BYTE Axis index (1-based) 1 (X axis)
Column WORD Column index for array element W#16#1
Line WORD Line index (for block access) W#16#0
VarName STRING[32] Symbolic NC variable name (audit/text reference) 'AA_TORQUE[X]'

FB2 Call Example

The call is typically issued from OB1 (or OB35 cyclic interrupt for a deterministic refresh):

CALL FB2, DB_NCVar (    // instance DB for FB2
    REQ     := TRUE,           // continuous read
    NR      := 1,              // refers to NCVar entry 1
    LADDR   := W#16#0,         // local NCK
    UNIT    := 1,              // X axis
    COLUMN  := 1,
    LINE    := 0,
    VALID   := #validX,        // output: data valid
    BUSY    := #busyX,         // output: read in progress
    ERROR   := #errX,          // output: error flag
    ERR_CODE:= #errCodeX,      // output: error code
    VALUE   := #torqueX        // output: real value
);

Once VALUE contains the torque, scale and write to the analog output via the Profibus DP slave's output words. Typical scaling: drive torque is reported in Nm referenced to the motor; convert to a ±10 V range using the maximum expected torque:

Vout_scaled = (torqueX / TorqueMax) * 10.0 // result in V, range ±10 V

Send Vout_scaled to the analog output module's process data word (e.g., QW 256 on the PLC image, mapped to the analog Profibus channel).

PLC cycle vs. NCK cycle: If FB2 is called in OB1, the refresh rate is the PLC cycle (typically 10–20 ms). For faster refresh, move the call to OB35 (typically 100 ms configurable to shorter intervals). The FB itself does not exceed the configured PLC cycle because each call returns only after one NCK handshake.

Required Software Option: 6FC5251-0AB17-0AA0

The four axis-internal drive quantities are bundled into a single Siemens option:

Option number Description Covers
6FC5251-0AB17-0AA0 Axis load / torque / current / power reading $AA_LOAD, $AA_CURR, $AA_TORQUE, $AA_POWER

Without this option, accessing $AA_TORQUE[X] returns zero or a constant placeholder, regardless of the synchronized action or FB2 configuration. Verify the option bit is set via the HMI under:

  • Commissioning → NCK → Options (SINUMERIK Operate)
  • Or in the option file (typically under /oem/sinumerik/ or via the HMI's installed options view).
Same option covers all four variables: $AA_LOAD, $AA_CURR, $AA_TORQUE, and $AA_POWER are all enabled by the single option 6FC5251-0AB17-0AA0. Switching from torque to current does not require a different option.

Axis Machine Data MD 36730

The source documentation explicitly calls out that after enabling the option bit, axis machine data MD 36730 must also be configured. The exact semantic role of MD 36730 in the load/torque option enablement path must be verified against the SINUMERIK 840D machine-data manual for the specific NCK software version, because the meaning of MD numbers in the 36xxx range varies between NCK versions.

Verification steps:

  1. In HMI Operate, navigate to Commissioning → Machine Data → Axis MD.
  2. Locate MD 36730 and confirm the expected value (refer to the NCK-specific machine data list / DoConWeb / Siemens support portal for the build).
  3. Save with the proper startup file (NCK reset / warm restart).

For definitive MD 36730 values, consult the SINUMERIK 840D machine data manual for the installed NCK version, available through the Siemens Industry Online Support portal.

Available Axis Variables

System variable Meaning Unit Update rate Option
$AA_TORQUE[X] Drive torque, axis X Nm IPO cycle 6FC5251-0AB17-0AA0
$AA_LOAD[X] Axis load (utilization) % IPO cycle 6FC5251-0AB17-0AA0
$AA_CURR[X] Axis current A (RMS) IPO cycle 6FC5251-0AB17-0AA0
$AA_POWER[X] Axis mechanical power W IPO cycle 6FC5251-0AB17-0AA0

All four are accessed with the same option and the same calling convention. The choice between them is a measurement question — for a load-cell surrogate on a servo, torque is the most direct equivalent; for thermal stress, current is more meaningful.

Method Comparison: FAST DMP vs. FB2

Criterion FAST DMP / $A_OUTA FB2 + analog output via PLC
Latency 1 IPO cycle (~4–12 ms) PLC cycle + NCK handshake (~10–40 ms)
PLC load None One FB call per refresh
Scalable in PLC? No (NCK-side math only) Yes (full PLC arithmetic)
Hardware FAST DMP module on NCK-side Any Profibus DP analog-output slave
Triggering Synchronized action FB call from OB1/OB35
Diagnostics $A_OUTA debug window FB2 VALID/ERROR/ERR_CODE
Failure mode if option missing $A_OUTA = 0 FB2 VALUE = 0, no error

Configuring the NCVar Selector for $AA_TORQUE

The NCVar selector DB must be edited before FB2 can be called. The procedure below assumes the PLC Toolbox basic program is loaded and the NCVar area is initialized in OB100 (cold restart):

  1. Open the PLC project in STEP 7 (or TIA Portal if migrated).
  2. Locate the NCVar selector DB — by convention DB120 — and open it.
  3. Fill row 1 with the parameters for $AA_TORQUE[X] as documented in the section above (NR=1, LADDR=W#16#0, Area=B#16#20, Unit=1, Column=1, Line=0, VarName='AA_TORQUE[X]').
  4. Compile and download the PLC program.
  5. On NCK side, verify option 6FC5251-0AB17-0AA0 is active and MD 36730 is configured.
  6. Trigger a PLC cold restart (OB100) to initialize the NCVar selector.
  7. From a programmer-side watch table, force DB120.DBW0 = 1 (NR) to match the row index used by the FB2 call.
  8. Monitor FB2 instance VALUE in the watch table — it should update to a non-zero value as soon as the axis moves.

Troubleshooting FB2 Returning No Useful Data

The original question reports that FB2 is implemented but no useful data appears on the PLC side. The following matrix covers the recurring failure modes seen in the field:

Symptom Likely root cause Corrective action
VALUE stays at 0 even with axis moving Option 6FC5251-0AB17-0AA0 not enabled Activate the option in HMI Operate under Commissioning → NCK → Options, then NCK warm restart
VALUE stays at 0, VALID never asserts NCVar selector row NR mismatch with FB call Ensure DB120.NR equals the NR input of FB2; only the row whose NR matches is read
VALUE returns random high-magnitude garbage Wrong Area / Unit / Column combination Re-derive from official NC variable listing; verify axis index is 1-based and column = 1 for axis-specific variables
VALUE updates only when REQ toggles, not continuously REQ not held TRUE; FB reads once per rising edge Hold REQ=TRUE in OB1 / OB35, or call FB2 in a cyclic OB with REQ permanently TRUE
ERR_CODE ≠ 0 NCK handshake error (timeout, bad area, unit mismatch) Cross-check ERR_CODE against the PLC Toolbox basic program manual; common codes: invalid area (wrong Area code), unknown unit, access denied
Plc reads zero but synchronized action on $A_OUTA returns correct value NCVar selector not initialized (OB100 not run, or PLC warm-restart) Force OB100 by cycling PLC STOP → RUN; confirm DB120 initialization FC call is present in OB100
VALUE correct on the first read, then freezes REQ is pulsed once and FB2 returns only on each edge Switch to REQ=TRUE continuous call, or move call to cyclic OB

Diagnostic Procedure for an FB2 Stuck-at-Zero

  1. Confirm the option: in HMI Operate, go to Commissioning → NCK → Options; verify 6FC5251-0AB17-0AA0 is active.
  2. Open the PLC online watch table; force the NCVar selector row 1 (NR=1, LADDR=W#16#0, Area=B#16#20, Unit=1).
  3. In the same watch table, force the FB2 inputs to match. Monitor VALID, BUSY, ERROR, ERR_CODE.
  4. Manually jog the X axis and observe VALUE. If it stays 0 with VALID never asserting, the selector row index or area code is wrong.
  5. Cross-reference the NC variable name in the SINUMERIK list of system variables — the spelling AA_TORQUE (capitalization irrelevant) must be the one supported by the installed NCK build.
  6. For the PLC Toolbox basic program reference (FB1, FB2/3/4/5 and the NCVar selector), refer to the SINUMERIK 840D sl PLC Basic Program programming manual available on the Siemens Industry Online Support portal.
Common FB2 pitfall: FB2 reads only the NCVar selector row whose NR matches the NR input. If multiple rows are defined, an NR mismatch will silently return VALUE=0. Always verify NR in both DB120 and FB2 input, and only define one selector row if reading a single variable.

Verification Procedure

  1. Option verification: HMI → Commissioning → NCK → Options → confirm 6FC5251-0AB17-0AA0 active.
  2. MD verification: HMI → Commissioning → Machine Data → Axis MD → MD 36730 → confirm value matches NCK manual.
  3. Synchronized action check: In the synchronized-action monitor, verify $A_OUTA[1] = $AA_TORQUE[X] is firing every IPO cycle.
  4. FB2 check: Watch FB2.VALUE — must reflect instantaneous torque while X axis is in motion.
  5. Analog output check: With a multimeter or scope on the Profibus analog-output terminals, confirm voltage scales with torque per the configured scaling.
  6. Continuity check: Through a full machining cycle (rapid + feed + dwell + rapid), confirm the analog voltage follows the X-axis torque profile without dropouts or frozen values.
Cross-check: Run both methods in parallel during commissioning and compare the FAST DMP analog voltage against the FB2-scaled analog voltage on the same X-axis torque input. Discrepancies indicate scaling or selector-row errors; agreement indicates a healthy configuration.

FAQ

Which option is required to read $AA_TORQUE on a Sinumerik 840D?

Option 6FC5251-0AB17-0AA0 must be enabled. It covers $AA_LOAD, $AA_CURR, $AA_TORQUE, and $AA_POWER in a single option bit. Without it, $AA_TORQUE returns 0 regardless of the configured access path.

What is the difference between using $A_OUTA and using FB2 to output torque?

$A_OUTA via FAST DMP is a direct NCK-to-analog path with one IPO cycle of latency and no PLC load. FB2 reads the NC variable into the PLC, where it can be scaled and written to any Profibus analog output, but introduces PLC cycle latency (typically 10–40 ms) and one FB call of CPU load per refresh.

FB2 returns zero on the PLC side even though the option is enabled. What should I check?

Confirm that the NCVar selector row NR matches the FB2 NR input, that LADDR/Area/Unit/Column are correct (typically W#16#0, B#16#20, axis index, W#16#1), that REQ is held TRUE in a cyclic OB, and that MD 36730 is configured for the axis. Also force OB100 to ensure NCVar selector initialization.

Is MD 36730 required for $AA_CURR or only for $AA_TORQUE?

The same option 6FC5251-0AB17-0AA0 covers $AA_CURR, $AA_TORQUE, $AA_LOAD, and $AA_POWER, and the MD 36730 axis machine data configuration applies to all four. Switching from torque to current does not require a different option, only a different NCVar selector row or a different $AA_* reference in the synchronized action.

Can both the FAST DMP path and the FB2 path run simultaneously on the same axis?

Yes. They are independent: the synchronized action writes $AA_TORQUE[X] to $A_OUTA[1] directly, while FB2 reads $AA_TORQUE[X] via the NCVar selector and writes it to a different analog output channel. This is a useful commissioning trick to validate that both paths see the same torque source.

Back to blog