Configuring 6FX2001-5QN25 for 0-359° Per-Turn Position on S7-1200

David Krause15 min read
S7-1200SiemensTutorial / 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

The Siemens 6FX2001-5QN25 is a multiturn absolute encoder from the 1FX2/6FX2 product family. The encoder optically resolves one mechanical revolution into 8,192 increments (13 bits) and uses a geared multiturn stage to count 16,384 revolutions (14 bits) before the turn counter wraps. The 27-bit absolute position is then transmitted as PROFINET IO to the controller. Telegram 81 is the simplest Siemens-specific free telegram for this device and is the correct choice when the application only needs the position value with minimum cyclic bus load.

This reference documents how to wire the encoder, configure a SIMATIC S7-1214C, select Telegram 81 in the TIA Portal, and then extract a 0-359° per-turn position in the PLC program. The key transformation is NORM_X followed by SCALE_X, which converts the raw 0-8191 count value to engineering units in degrees. The same code path also works for the S7-1215C and S7-1217C CPUs; the only difference is the larger process image and the availability of a second PROFINET port on those CPUs.

Critical constraint: 6FX2001 encoders are PROFINET IO devices. The S7-1214C DC/DC/DC and DC/DC/RLY variants expose one PROFINET port on the CPU (X1P1, top connector labeled PROFINET). If the encoder is on a separate subnet, add a managed PROFINET switch (e.g., SCALANCE XC-100) or use the second PROFINET port of an S7-1215C / S7-1217C. The CM 1243-1 / CP 1243-1 communication modules do not support PROFINET IO controller mode on the S7-1200; the integrated port is the controller port.

Encoder Identification and Type Plate

The 6FX2001-5QN25 is identified by its Siemens order number (MLFB). The part number decodes the electrical and mechanical options:

Field Code Meaning
Product family 6FX2 Encoder, absolute, PROFINET IO
Sub-family 001 Hollow-shaft, built-in
Resolution 5 13-bit singleturn (8,192 steps / rev)
Turns Q 14-bit multiturn (16,384 turns)
Shaft / flange N 10 mm hollow shaft, spring washer
Connection 2 PROFINET cable gland / M12
Option 5 Customer-specific

Confirm the actual resolution and turn count on the encoder nameplate. Stock units read ST 13 / MT 14; variants with ST 12 / MT 12 or ST 13 / MT 12 exist in the 6FX2001 family and require different scaling values. The values entered in TIA Portal and in the GSDML device description must match the type plate.

Parameter Value
Singleturn resolution 8,192 counts / revolution (13 bits)
Multiturn range 16,384 revolutions (14 bits)
Total position range 2^27 = 134,217,728 counts
Code direction Binary, increasing clockwise (viewed on shaft)
Cycle time (PROFINET) ≥ 1 ms (RT) or 250 µs (IRT)
Supply voltage 24 V DC (10 V to 30 V)
Current draw ≤ 250 mA at 24 V
Protection class IP65 / IP67 (mated connector)
Interface PROFINET IO, Conformance Class C

For the steps-per-revolution parameter used in SIMATIC technology objects, the value to enter is 8,192 for a stock 6FX2001-5QN25. If the encoder is parameterized to a different resolution through PROFINET record sets, the steps per revolution must be matched in the TIA Portal encoder parameterization. The Siemens Encoder Parameterization for the SIMATIC S7 Technology Functions document lists the full set of supported values (e.g., 512, 1024, 2048, 4096, 8192) and the GSDML record numbers used to write them.

PROFINET Telegram 81 Data Layout

Telegram 81 is a Siemens-specific free telegram designed for absolute encoders with SSI-compatible position data. The telegram carries 4 input bytes (the 32-bit position) and 4 output bytes (control words and preset). Telegrams 82, 83 and 84 extend the layout with additional status information, additional encoders, and speed / acceleration values respectively. Telegram 860 adds PROFIsafe on top of Telegram 82. For a single 6FX2001-5QN25 used purely for 0-359° position, Telegram 81 is the smallest and the most efficient choice.

Byte Word Direction Description
0..1 IWn Input (encoder → PLC) Lower 16 bits of the 32-bit position (counts within the current revolution)
2..3 IWn+2 Input (encoder → PLC) Upper 16 bits of the 32-bit position (turn counter, 0..16383)
4..5 QWn Output (PLC → encoder) Control word (bit 0 = preset, bit 1 = reset, bit 8 = code direction)
6..7 QWn+2 Output (PLC → encoder) Preset value (loaded on rising edge of preset bit)

The exact input address (n) is shown in the device overview of TIA Portal once the encoder is added and Telegram 81 is selected. With default slot assignment, the first slot (slot 0) is the status word / control word interface, and slot 1 carries the 4 bytes of position. The S7-1214C therefore typically places the position value at IW 8 (low word) and IW 10 (high word) of the input process image, which the discussion thread confirms.

Telegram 81 — 32-bit Position Word (ID at slot 1) IW n — Counts within current revolution 0 .. 8191 (0x0000 .. 0x1FFF) IW n+2 — Number of revolutions 0 .. 16383 (0x0000 .. 0x3FFF) Bit 0 (LSB) Bit 31 (MSB) Bit 0..12 → singleturn (13 bits) Bit 13..26 → multiturn (14 bits) Bit 27..31 → reserved (0)

Hardware Configuration and Topology

The S7-1214C has one PROFINET port on the CPU (X1P1). Wire the encoder port 1 to the CPU directly, or through a PROFINET switch if you have multiple devices. Set the encoder's PROFINET device name to something descriptive (e.g., enc-6fx2001-001) using the PRONETA tool or the TIA Portal topology editor. Address the encoder with a fixed IP in the same subnet as the CPU (e.g., CPU 192.168.0.1, encoder 192.168.0.10, subnet mask 255.255.255.0).

Connection Pin Wire Signal
X1P1 (CPU) Port 1 1 Yellow TD+
2 Orange TD−
3 White RD+
6 Blue RD−
24 V supply + Red +24 V (10..30 V)
− Black 0 V

Use shielded PROFINET cable (e.g., 6XV1840-2AH10) with shield grounded at both ends through the M12 connector. The encoder's M12 D-coded connector (4-pin) carries both data and 24 V supply on a hybrid cable (e.g., 6XV1860-2H).

Watchdog: With Telegram 81, the encoder expects an update rate ≤ 32 ms. The default PROFINET send clock is 1 ms. If the application reduces the send clock to 250 µs, confirm that the encoder firmware supports that cycle (most 6FX2001 PROFINET devices support down to 500 µs; firmware version 2.4 or higher is required for 250 µs IRT). Older encoders at firmware 1.x default to 1 ms.

TIA Portal Device Configuration

  1. Open the TIA Portal project that contains the S7-1214C.
  2. In the project tree, right-click Devices & Networks and select Add new device → PROFINET IO Device.
  3. Search for the GSDML file of the 6FX2001-5QN25 in the hardware catalog. The file is installed by the Siemens HSP (Hardware Support Package) HSP0180 — Encoders 6FX2 / 1FX2 PROFINET, available on the Siemens Industry Online Support portal. After installation, the device appears under Other field devices → Encoder → SIEMENS AG → 6FX2001.
  4. Drag the encoder onto the PROFINET subnet of the S7-1214C.
  5. Open Device view on the encoder, then open Properties → Module parameters → Slot 1.
  6. Select Telegram 81 as the I/O type. The slot layout updates to show 4 input bytes and 4 output bytes.
  7. Set the encoder's PROFINET device name to a unique value. The CPU uses the name to find the device at boot via DCP.
  8. Assign the encoder to the IO controller (the S7-1214C) and download the configuration.

After the download, the Online & Diagnostics view of the encoder should show a green PROFINET state, and the input bytes should update at the configured send clock rate.

Process Image Address Mapping

Once Telegram 81 is selected, TIA Portal automatically assigns a starting input and output address to the slot. The starting address can be changed in Properties → IO tags of the encoder. With slot 1 set to 4 input bytes + 4 output bytes, the defaults are typically:

Tag Address Description
Position low word (counts within rev) IW 8 0 .. 8191 (0x0000 .. 0x1FFF)
Position high word (turn counter) IW 10 0 .. 16383 (0x0000 .. 0x3FFF)
Control word QW 8 Preset, reset, code direction
Preset value QW 10 Loaded on rising edge of preset bit

Combine IW 8 and IW 10 into a 32-bit DWORD:

// SCL — assemble the 32-bit position
#Position_DWORD := DWORD#16#0000_0000;
#Position_DWORD.%W0 := "Encoder".IW10;   // high word (turns)
#Position_DWORD.%W2 := "Encoder".IW8;    // low word  (counts in rev)

If the S7-1200 is configured in big-endian byte order, the assignment of high and low words is reversed. In the default TIA Portal byte order (little-endian, aligned with the S7-1200 system), the example above is correct.

Extracting 0-359° with NORM_X and SCALE_X

The per-revolution count is the low word IW 8 and ranges from 0 to 8191. Two IEC instructions convert this raw value into engineering units in degrees:

  • NORM_X — Normalizes the input to a floating-point value in 0.0 .. 1.0, given the input minimum and maximum.
  • SCALE_X — Scales a normalized 0.0 .. 1.0 floating-point value to an output range, given the output minimum and maximum.

Used together, the pair is the standard Siemens way to convert any linear input to any linear output. For a 0-359° output, the parameters are:

Block Parameter Value Meaning
NORM_X VALUE IW 8 Raw encoder word
NORM_X MIN 0 Lower raw bound
NORM_X MAX 8191 Upper raw bound (8,192 − 1)
SCALE_X MIN 0.0 Lower engineering bound (°)
SCALE_X MAX 359.0 Upper engineering bound (°)

The SCL implementation in OB 1 or a cyclic OB:

// SCL — convert IW 8 to 0.0 .. 359.0 degrees
IF "Encoder_OK" THEN
    // 1) normalize raw count to 0.0 .. 1.0
    #norm_x_out := NORM_X(
        VALUE := "Encoder".IW8,
        MIN   := 0,
        MAX   := 8191);
    // 2) scale 0.0 .. 1.0 to 0.0 .. 359.0 deg
    #Angle_deg := SCALE_X(
        MIN   := 0.0,
        VALUE := #norm_x_out,
        MAX   := 359.0);
ELSE
    #Angle_deg := 0.0;
END_IF;

The result #Angle_deg is a REAL in the range 0.0 .. 359.0. The encoder reports a value of 8191 at almost a full revolution, but the mapping to 359° means the last count never produces a full 360°; if the application needs a true 0-360° scale, set the SCALE_X MAX to 360.0 and accept the linear error of one LSB at the top of the range.

NORM_X / SCALE_X — 0-8191 to 0-359° IW 8 0..8191 NORM_X 0.0..1.0 SCALE_X 0.0..359.0° REAL Formula: y = MIN_OUT + (VALUE − MIN_IN) / (MAX_IN − MIN_IN) · (MAX_OUT − MIN_OUT) Substituting: deg = 0.0 + (count − 0) / 8191 · 359.0 = count · 0.0438104° (per LSB)

Single-Turn vs Multiturn Configuration

If the application does not need the turn count (i.e., the 14-bit multiturn part of the 32-bit word), Telegram 81 still works but the upper 16 bits are simply ignored. The user has three options:

Option Pros Cons
Use full multiturn, extract low word Turn counter always available PLC tracks 16384-turn wrap
Use full multiturn, mask low word only No scaling needed for the counts Same wrap-around issue
Parameterize encoder to singleturn only No wrap-around; simpler logic Loses absolute revolution count on power loss

To switch the encoder to singleturn, write a parameter record via PROFINET to the encoder's parameter interface (record index 0x2001 / subindex 0x01 for resolution, 0x2001 / subindex 0x02 for turns). The exact record indices are documented in the GSDML file. The simplest way to write the record in TIA Portal is through a WR_REC call from the user program, or through the Online & Diagnostics page of the encoder in TIA Portal V17 or higher.

Singleturn caveat: Switching to singleturn loses the mechanical turn memory. On power-cycle, the encoder reports the new position within the current revolution but cannot tell which revolution of the previous history it is in. This is acceptable for applications that re-home on power-up (e.g., using a limit switch) and unacceptable for applications that need absolute position across a power loss.

Turn Counting and Wrap-Around Handling

The 6FX2001-5QN25 has 14 bits of multiturn resolution, so the high word wraps from 16383 to 0 every 16,384 revolutions. If the application needs the cumulative turn count (e.g., a winding machine that unspools more than 16,384 turns over its lifetime), the PLC must keep a software counter that increments on the wrap and a software counter that decrements on a reverse wrap. The standard pattern in SCL is:

// SCL — track cumulative turns across the 16,384-turn boundary
#Turn_raw := "Encoder".IW10;          // 0..16383
IF #first_scan THEN
    #Turn_soft := 0;
    #Turn_prev := #Turn_raw;
    #first_scan := FALSE;
END_IF;

IF (#Turn_raw - #Turn_prev) > 8192 THEN
    // wrap from 0 to 16383 (backward rotation)
    #Turn_soft := #Turn_soft - 1;
ELSIF (#Turn_prev - #Turn_raw) > 8192 THEN
    // wrap from 16383 to 0 (forward rotation)
    #Turn_soft := #Turn_soft + 1;
END_IF;
#Turn_prev := #Turn_raw;

// Cumulative revolution count
#Total_rev := DINT_TO_LREAL(#Turn_soft) * 16384.0 + LREAL_TO_DINT(#Turn_raw);

The threshold of 8192 is half the multiturn range; this is the canonical Siemens pattern for handling encoder wrap-around in the PLC. The pattern is robust to the encoder's range being reconfigured (e.g., 12-bit multiturn) by changing the modulus to half the configured range.

Verification and Commissioning Checks

  1. Watch table — monitor IW 8 in online mode. Rotate the shaft by hand through one full revolution. The value should sweep 0 → 8191 → 0 with no jumps and no missing codes.
  2. Watch table — monitor IW 10. Rotate the shaft slowly through 16,384 revolutions. The value should increment monotonically and wrap to 0 at the 16,384th revolution.
  3. Trace — record #Angle_deg over one full revolution in a TRACE recording (TIA Portal V17 or higher). The plot should be a clean sawtooth from 0° to 359°.
  4. Step response — set a fixed reference angle in degrees, command the encoder to that angle mechanically, and verify that #Angle_deg matches to ± 1 LSB (≈ 0.044°).
  5. Power-cycle test — turn off the encoder supply for 5 seconds, then turn it back on. After re-initialization, the value should be the same as before the power cycle to within 1 LSB.

Troubleshooting Matrix

Symptom Likely Cause Diagnostic Remedy
IW 8 stuck at 0 Encoder not seen on PROFINET; bus error Online & Diagnostics → Encoder → Module state Check device name, IP, and cable; assign a unique device name with PRONETA
IW 8 stuck at 0xFFFF Encoder diagnostic alarm; sensor defective Diagnostics buffer of CPU; LED status of encoder Power-cycle the encoder; replace if persistent
IW 8 jumps by thousands per cycle Wrong slot / wrong telegram selected Compare slot 1 telegram to device view Re-select Telegram 81; recompile the hardware config
IW 8 increments correctly but #Angle_deg is constant Wrong MIN/MAX on NORM_X or SCALE_X Watch the norm_x_out variable Re-enter 0 / 8191 for NORM_X and 0.0 / 359.0 for SCALE_X
Position jumps by 360° at wrap Encoder wrap-around in turn counter not handled Watch IW 10 over the 16384th revolution Implement the cumulative-turn counter pattern shown above
Position drifts after power cycle Encoder parameterized to singleturn Encoder parameterization page in TIA Portal Re-parameterize to multiturn; download new configuration
CPU goes to STOP with "IO device failure" Encoder name conflict on the subnet PRONETA scan; double device name Rename one of the conflicting devices
Send clock alarm (slot 1) Send clock < 500 µs on old encoder firmware Encoder firmware version in device properties Increase send clock to 1 ms; update encoder firmware if available

Integration with SIMATIC Technology Objects

For motion applications, the per-revolution position can also feed a TO_PositioningAxis technology object on the S7-1200. The TO expects a steps-per-revolution parameter; the value to enter is 8,192. The encoder parameterization page of the technology object must reference the same PROFINET telegram and slot. With the axis configured in positioning mode, the technology object automatically applies the same NORM_X / SCALE_X logic to expose the position in user units. The Siemens Encoder Parameterization for the SIMATIC S7 Technology Functions FAQ documents the steps-per-revolution field and lists the supported resolutions.

TO caveat: S7-1200 technology objects support up to 4 axes on the CPU. Each axis uses one of the four high-speed counters of the CPU, or one of the PROFINET slots if the encoder is a PROFINET device. The 6FX2001-5QN25 occupies one PROFINET slot, not a high-speed counter, so the HSC resources of the S7-1214C remain available for other I/O.

References to Siemens Documentation

The following Siemens Industry Online Support pages and manuals are the authoritative reference for the topics covered in this article:

  • Encoder Parameterization for the SIMATIC S7 Technology Functions — official Siemens FAQ, lists the supported steps-per-revolution values and the GSDML record indices.
  • SIMATIC S7-1200 Programmable Controller — System Manual, entry ID 109741175 on Siemens Industry Online Support.
  • STEP 7 Basic V17 in the TIA Portal — Programming and Operating Manual, entry ID 109751942 on Siemens Industry Online Support.
  • PROFINET Field Bus Installation Guidelines, entry ID 49948838 on Siemens Industry Online Support.

What is the default steps-per-revolution of the 6FX2001-5QN25?

The stock 6FX2001-5QN25 has a 13-bit singleturn resolution, which is 8,192 counts per revolution. This is the value entered in the encoder parameterization of the TIA Portal device configuration and in the SCALE_X MIN/MAX parameters.

How many turns does the 6FX2001-5QN25 count before wrap-around?

The encoder is a 14-bit multiturn device, so it counts 16,384 revolutions before the turn counter wraps from 16383 back to 0. For applications that need more than 16,384 turns, the PLC must track the cumulative turn count in software, using the half-range wrap pattern documented above.

Why use Telegram 81 instead of Telegram 82 or 83?

Telegram 81 is the smallest Siemens-specific free telegram for an absolute encoder, carrying 4 input bytes and 4 output bytes. Telegram 82 adds status information, Telegram 83 supports a second encoder on the same device, and Telegram 84 adds speed and acceleration. For a single encoder used only for 0-359° position, Telegram 81 is the most efficient choice and minimizes the bus load.

Can I read both the turn counter and the per-revolution position from Telegram 81?

Yes. Telegram 81 carries the full 32-bit position in two 16-bit words. The low word is the per-revolution count (0..8191) and the high word is the turn counter (0..16383). The per-revolution position is read directly from the low word, and the turn counter is read from the high word with the wrap-around logic above.

How do I prevent a position jump when the encoder crosses the 16,384-turn boundary?

Implement a software turn accumulator in the PLC that increments when the raw turn counter wraps from 16383 to 0 and decrements when it wraps from 0 to 16383. The threshold for detecting the wrap is half the multiturn range, i.e., 8,192 counts. Combine the soft accumulator with the raw turn counter to form a 64-bit total revolution count that never wraps within the lifetime of the machine.

Why does the position drift after a power cycle?

If the encoder has been parameterized to singleturn, it loses the mechanical turn memory on power loss. The default factory setting of the 6FX2001-5QN25 is multiturn, but it can be reconfigured through a PROFINET record write. Re-parameterize the encoder to multiturn if absolute position across power cycles is required.

Back to blog