Reading Siwarex U Gross Data on S7-300 via PIW and SFB52
Siwarex U is the SIMATIC S7-300 single-channel/two-channel weighing electronics (MLFB 7MH4950-xAA01) that occupies a standard slot in the S7-300 rack and reports the live gross weight through three independent read paths: the cyclic process image (PIW), acyclic data records, and the pre-built SIWA_U function block from the configuration package. On legacy CPUs such as the 6ES7315-2AG10-0AB0 whose operating system predates the Step 7 V5.5 SP reorganization of record-handling system functions, the cleanest paths to gross data are direct PIW read and SFB52 RDREC. This reference consolidates the firmware constraint, the three access paths, the data record map, integer-to-engineering-unit conversion, HW Config integration, and a commissioning verification procedure that you can run against a Siwarex U module on the bench.
1. Siwarex U Module Identification
Before any read code is written, confirm the exact module variant. The Siwarex U family is split into single-channel and two-channel variants, and the configuration package that ships the SIWA_U FB and SIWATOOL is a separate order number from the hardware.
| MLFB | Function | Channels | Notes |
|---|---|---|---|
| 7MH4950-1AA01 | Siwarex U single-channel weighing module | 1 | 1× RS-232, 1× RS-485 |
| 7MH4950-2AA01 | Siwarex U two-channel weighing module | 2 | Used for dual load-cell platforms |
| 7MH4950-1AK01 | Siwarex U Configuration Package, single channel | — | Includes SIWA_U FB, SIWATOOL, GSD/GSDML, manual set |
| 7MH4950-2AK01 | Siwarex U Configuration Package, two channel | — | Same as -1AK01 plus two-channel FB |
The configuration package is delivered on CD or DVD and contains the STEP 7 V5.x library with SIWA_U, the SIWATOOL U commissioning software, the HMI integration for ProTool/ WinCC flexible, and the device manual that documents the data record layout referenced in Section 5 of this article. The package does not contain a firmware update for the Siwarex U itself — module firmware is bundled with the CPU and ships pre-installed on the module.
2. S7-300 CPU Firmware Constraint on the 315-2AG10
The 6ES7315-2AG10-0AB0 is a 315-2DP from the original S7-300 series whose last released firmware is v2.6.11. The replacement hardware 6ES7315-2AH14-0AB0 ships with firmware v3.x and is roughly 2× faster with 2× the work memory, but it is a different MLFB and is not a drop-in FW upgrade for the -2AG10. Treat the two CPUs as separate parts for spares, lifecycle, and support.
| CPU MLFB | Latest FW | Has SFC59 RD_REC in OS | Supports SFB52 RDREC | Status |
|---|---|---|---|---|
| 6ES7315-2AG10-0AB0 | V2.6.11 | Yes (OS-resident SFC) | Yes (SFB instance required) | Phase-out, spare-part only |
| 6ES7315-2AH14-0AB0 | V3.x | Yes | Yes | Current production |
Three rules to keep in mind when you see Step 7 grey out the download button for SFC59:
- System functions (SFC/SFB) that are part of the CPU operating system cannot be downloaded into the CPU as blocks — the OS image already contains them. Step 7 only lets you download blocks that belong to the S7 program (OB, FB, FC, DB, UDT, VAT).
- If Step 7 does not show SFC59 in the program element browser, the installed STEP 7 version does not include that SFC in its standard library — not the CPU. Reinstall the matching STEP 7 version or call the SFC by absolute number.
- For record-oriented read/write the canonical modern call is SFB52 RDREC and SFB53 WRREC. They work on every S7-300/400 CPU that supports acyclic record communication and do not depend on SFC59 being present in any particular STEP 7 library install.
3. Three Access Paths to Gross Data
| Path | Mechanism | Update rate | Where to use it |
|---|---|---|---|
| PIW cyclic | Process image read at OB1 cycle | Every cycle (~10 ms typical) | Fast control loops, HMI live tag, setpoint comparison |
| DR acyclic | SFB52 RDREC against the Siwarex data records | On demand | Calibration values, advanced process values, status bits, alarms |
| SIWA_U FB | Pre-built function block from 7MH4950-xAK01 | Configurable scan | Recipes, multi-scale management, two-channel averaging |
The PIW path is the lowest-latency method and the only one guaranteed to be present in a stripped-down STEP 7 project. The DR path is preferred whenever you also need status, range, unit, or filter information. The SIWA_U FB is a productivity play: it wraps the SFB52 calls, handles the busy/error handshake, exposes engineering units, and provides a standard interface for setpoint and zero commands.
4. Method 1 — Direct Periphery Read (PIW)
The Siwarex U slot occupies 16 bytes in the I/O area of the S7-300. The default address assignment is slot 4 of rack 0, giving a PI start address of 256 (decimal). Channel 1 always reports gross at PIW 258 (word 2, offset +4); on a two-channel Siwarex U (-2AA01) channel 2 reports gross at PIW 266 (word 10, offset +20). The values are 16-bit signed integers representing the gross weight in the unit configured for the channel (typically grams or kilograms depending on DR 0 scaling).
| Slot offset | Symbolic name | Length | Content |
|---|---|---|---|
| PQW 256 / PIW 256 | Word 0 | 2 bytes | Channel 1 status / range byte + reserved |
| PIW 258 | Word 2 | 2 bytes | Channel 1 integer gross weight |
| PIW 260 | Word 4 | 2 bytes | Channel 1 net or tare (model-dependent) |
| PIW 262 | Word 6 | 2 bytes | Channel 1 status bits / limits |
| PIW 264 | Word 8 | 2 bytes | Channel 2 status / range byte |
| PIW 266 | Word 10 | 2 bytes | Channel 2 integer gross weight (two-channel module only) |
| PIW 268 | Word 12 | 2 bytes | Channel 2 net or tare |
| PIW 270 | Word 14 | 2 bytes | Channel 2 status bits |
Sample STL logic to load channel 1 gross into MW200 and break it into status byte MB202 plus gross word MW200:
// Read channel 1 gross and status from Siwarex U (slot 4, PI start = 256)
L PIW 258 // Channel 1 integer gross weight
T MW 200 // MW200 = gross integer
L PIB 256 // Status / range byte, channel 1
T MB 202 // MB202 = status, MB203 reserved
L PIW 266 // Channel 2 gross (two-channel module only)
T MW 204 // MW204 = gross integer, channel 2
The full byte map, status bit definitions, and the channel-2 offsets are documented in the Siwarex U device manual chapter 8.8 (Periphery). The chapter also lists the conditional bytes (e.g., the high-byte of word 0 carries the weighing range identifier on certain FW versions; this must be cross-checked against the manual revision that ships with your module).
L PIW 258 reads the snapshot that OB1 took at the start of the cycle. If you need a fresh sample within the same cycle, use L PEB 4 / L PEW 258 with the appropriate direct peripheral read instruction, or force the Siwarex U into the process image partition that is updated by OB35. The Siwarex U supports PIP1..PIP4 for isochronous-style update.5. Method 2 — Acyclic Read with SFB52 RDREC
SFB52 RDREC reads a data record from the Siwarex U module using the logical address configured in HW Config. The call returns the gross weight, the net weight, status, unit, and the resolution per digit in a single read when you target the process-value data record. The data record layout for Siwarex U differs from the Siwarex WP321 / ET 200SP family, but the concept is the same — the current process values live in a fixed record that you can poll at low frequency (every 100–500 ms is typical) and the advanced values (min/max, totaliser, statistics) live in a second record.
Instance DB and call example in STL:
DATA_BLOCK DB52
SFB52_INSTANCE // Static instance of SFB52 RDREC
END_DATA_BLOCK
// Call SFB52 to read DR 30 (current process values) from Siwarex U
CALL SFB 52, DB52
REQ :=M10.0 // Trigger on rising edge
IOID :=B#16#54 // 0x54 = input area, 0x55 = output area
LADDR :=W#16#100 // Logical base address of Siwarex U slot (256 dec = 0x100)
RECNUM:=B#16#1E // Data record 30 (current process values)
RET_VAL:=MW12 // Return code (0 = no error on completion)
BUSY :=M10.1 // 1 while transfer active
RECORD:=P#DB53.DBX0.0 BYTE 32 // Destination buffer, min 32 bytes
AN M 10.1
S M 10.2 // M10.2 = read complete, error in RET_VAL
The READ destination must be a pointer to a data area at least as long as the longest record you intend to read; for Siwarex U a 32-byte buffer is sufficient for the current process values record and a 64-byte buffer covers the advanced values. Do not overlap the destination area with the SFB's instance DB; SFB52 uses the instance DB for its own STAT variables.
6. Method 3 — SIWA_U Function Block from the Configuration Package
The SIWA_U FB (and its multi-instance variant SIWA_U_2 for two-channel modules) is shipped in the 7MH4950-1AK01 or 7MH4950-2AK01 configuration package. It encapsulates the SFB52 and SFB53 record calls, manages the busy/ack handshake, exposes gross/net in REAL engineering units, and provides the command interface (zero, tare, calibrate) that you would otherwise have to build from data record writes.
Typical usage in OB1:
// SIWA_U instance, single-channel scale, address 256 dec
CALL FB 100, DB100 // SIWA_U from 7MH4950-1AK01
LADDR :=256 // Logical base address
CH :=1 // Channel 1
GROSS :=MD200 // REAL, engineering units (kg by default)
NET :=MD204 // REAL, engineering units
CMD_TARE :=I 0.0 // Pushbutton, edge-triggered
CMD_ZERO :=I 0.1 // Pushbutton, edge-triggered
SCALE_OK :=M 20.0 // Module healthy, no diagnostic pending
ERROR :=MW 22 // Word, see SIWA_U manual for codes
ERROR_CODE :=MB 24 // Byte, Siwarex U diagnostic code
The block is CPU-agnostic; it does not call SFC59. It uses SFB52 and SFB53 as STAT-internal helpers, which means it works on the 6ES7315-2AG10-0AB0, the -2AH14, and any newer S7-300/400/ET 200S CPU that supports the standard RDREC/WRREC SFBs. The GROSS and NET outputs are REAL values already scaled by the Siwarex U calibration parameters, so you do not have to apply any integer-to-engineering-unit conversion in your application code.
7. Data Record Map for Siwarex U
The Siwarex U follows the same record-naming convention as the rest of the Siwarex family, but the byte layout is module-specific. The data records that matter for gross-data access are:
| DR | Length | Content | Read/write |
|---|---|---|---|
| 0 | varies | Module parameters (unit, resolution, filter, limits) | R/W |
| 1 | varies | Calibration data (calibration weight, zero, span) | R/W (password protected) |
| 2 | varies | Info / identification (MLFB, FW, serial) | R |
| 3 | 8 bytes | Status / diagnostic (see Section 9) | R |
| 30 | 32 bytes | Current process values: gross, net, tare, unit, status | R |
| 31 | 64 bytes | Advanced process values: min, max, totaliser, statistics | R |
The conceptual mapping of DR 30 = current process values and DR 31 = advanced process values is shared with the Siwarex WP231/WP321 family for ET 200SP. For the WP321/WP321 record definition and the bit meaning of the status word, see the Siwarex WP321 DR 30 documentation. For the Siwarex U byte layout always refer to the Siwarex U device manual chapter 8.8 that ships with the configuration package; the byte offsets and bit positions are not identical to WP321.
8. Converting Integer Gross to Engineering Units
The PIW and the raw integer field of DR 30 return a 16-bit signed integer in the unit and resolution configured in DR 0. The default Siwarex U ships configured to one digit = 1 kg, so a raw value of 1234 corresponds to 1234 kg. To convert to grams, multiply by 1000; to pounds, multiply by 2.20462. The cleanest engineering-units conversion lives in DR 0 and is set during calibration:
// Pseudo-code: convert integer gross to kg with three decimal places (grams resolution)
L PIW 258 // Integer gross from Siwarex U
ITD // Integer to double integer
DTR // Double integer to REAL
L 1.0 // 1 digit = 1 kg baseline; substitute from DR 0
*R // REAL multiplication
T MD 200 // Gross in kg with configured resolution
For recipes that require engineering units not supported natively by Siwarex U (e.g., liters with a known specific gravity), do the conversion in the S7 program rather than changing the module's unit. Changing the Siwarex U unit invalidates the calibration and the traceable measurement chain.
9. Diagnostics and Fault Matrix
| Symptom | Likely root cause | Verification | Fix |
|---|---|---|---|
| PIW 258 reads 0 or 7FFF on a live scale | Module is in commissioning mode or DR 0 not committed | SIWATOOL U online view of DR 0 | Save DR 0 to module, restart |
| PIW 258 reads 32767 (0x7FFF) steady | Over-range or sense-line open | Check load cell wiring, DR 3 status | Re-terminate, replace load cell |
| SFB52 RET_VAL = 0x80A1 | Module does not support the record number | Cross-check with Siwarex U manual table | Use DR 3 for status first, then DR 30 |
| SFB52 RET_VAL = 0x80A2 | Access error — slot not configured or wrong IOID | HW Config: check slot occupied | Re-assign LADDR or correct IOID |
| SFB52 RET_VAL = 0x80C3 | Resource bottleneck, module busy | Check BUSY bit and slot number | Space calls in time, single instance per module |
| SIWA_U ERROR = 16#0001 | No communication to module | Diagnostic buffer of CPU | Check backplane connector, slot, FW |
| SIWA_U ERROR_CODE = 16#05 | Calibration invalid / limit violated | SIWATOOL U calibration view | Recalibrate with valid weight |
| PIW values flicker between 0 and 32767 | EMC issue on load cell cable or unshielded routing | Scope on load cell lines, check shield | Re-route cable in grounded conduit, terminate shield at module end only |
10. Configuration and Commissioning in STEP 7 V5.x
- Install the configuration package (7MH4950-1AK01 or -2AK01). The package adds the Siwarex U to the STEP 7 hardware catalog under SIMATIC 300 > FM/CP > Siwarex.
- Open HW Config for the S7-300 station. Drag the Siwarex U from the catalog to the target slot. Default slot is 4; the PI start address is 256 unless you change it.
- Double-click the slot. Confirm the Address tab shows input start address 256 and the channel count matches the hardware (1 or 2).
- Install the SIWA_U FB from the library delivered with the package. The block family lives in the Siwarex U library under FB100 SIWA_U (single channel) and FB101 SIWA_U_2 (two channel). Drag into the S7 program and instantiate with a DB (e.g., DB100).
- Call the FB in OB1, wire the LADDR, and assign CMD inputs to pushbuttons or HMI tags.
- Connect SIWATOOL U to the Siwarex U RS-232 or RS-485 port. Set DR 0 unit, resolution, filter, and limits. Save to the module (the green button in SIWATOOL U commits the record).
- Apply the calibration weight and execute the calibration procedure from SIWATOOL U. Confirm the integer gross on PIW 258 matches the applied weight within the configured resolution.
- Read DR 3 to verify the module status word shows 0 (no diagnostic pending).
11. Commissioning Verification Procedure
- With no load on the scale, observe PIW 258 in VAT. It should read 0 ± the configured zero band (typically ±2 digits).
- Apply a known calibration weight of at least 50% of the platform capacity. PIW 258 should equal the weight in configured units within ±1 digit.
- Read DR 30 with SFB52. Confirm the gross field in the destination buffer matches PIW 258 exactly. If it does not, suspect a process-image update timing issue or a stale buffer.
- Read DR 3. Status word should be 0x0000. Any non-zero bit must be decoded against the Siwarex U manual status table.
- Force a tare command via SIWA_U or via DR 0 command bit. The net field of DR 30 should go to 0; the gross should not change.
- Remove all load. Confirm the gross returns to the same value observed in step 1. If it drifts more than the configured zero band, the load cell installation has mechanical hysteresis or thermal drift; check mounting.
- Run a linearity check at 0%, 25%, 50%, 75%, and 100% of capacity. Record the deviation against the Siwarex U error class; replace the load cell if deviation exceeds the datasheet limit.
12. Field-Proven Caveats
- The CPU 6ES7315-2AG10-0AB0 is in the Siemens phase-out lifecycle. If you are planning a new install, choose the -2AH14. The pin-out is identical, the STEP 7 program is source-compatible, and you gain firmware v3.x and 2× the work memory.
- Siwarex U configuration package 7MH4950-xAK01 does not include a module firmware updater. The Siwarex U module firmware is part of the device and is not field-flashable. If you need different module firmware, replace the module.
- If STEP 7 shows the SFC59 download button greyed out, it is a STEP 7 install issue, not a CPU OS issue. Reinstall the matching STEP 7 service pack. You do not need SFC59 for this application — SFB52 is the supported path.
- Direct PIW read is the only path that survives a CPU STOP-to-RUN transition without any user code change. SFB52 RDREC requires the user program to be running and the FB instance to be called. For a hard-wired interlock that must hold even in CPU STOP, use the PIW value, not the DR value.
- For an ET 200S distributed Siwarex U station on PROFIBUS DP, the logical address changes to the PROFIBUS address of the station. The byte offsets in Section 4 remain the same; only LADDR changes.
Why does STEP 7 disable the SFC59 download button on my 315-2AG10?
System functions (SFC/SFB) live in the CPU operating system and cannot be downloaded as user blocks. If STEP 7 hides SFC59 in the program element browser, your installed STEP 7 version is missing the library. Reinstall the matching STEP 7 service pack or call SFC59 by absolute number. Better still, switch to SFB52 RDREC and SFB53 WRREC, which are part of the standard library and work on every S7-300 CPU that supports acyclic record communication.
Which PIW holds the gross weight on a Siwarex U?
On a single-channel module at default slot 4 (PI start 256) the integer gross of channel 1 is at PIW 258 (word 2, offset +4). On a two-channel Siwarex U (-2AA01) the integer gross of channel 2 is at PIW 266 (word 10, offset +20). The full byte map is in the Siwarex U device manual chapter 8.8. Note that the high byte of word 0 carries the range identifier on some firmware revisions; always cross-check against the manual revision that ships with your hardware.
Can I read gross and net at the same time with SFB52?
Yes. Data record 30 (current process values) returns gross, net, tare, unit, and status in a single 32-byte read. Poll DR 30 every 100–500 ms for HMI and trending; use the PIW read at OB1 rate for fast interlocks. For an averaging or min/max/totaliser report, use data record 31 (advanced process values, 64 bytes) on a slower cycle.
Does the SIWA_U FB work without the configuration package installed?
No. SIWA_U (FB100) and SIWA_U_2 (FB101) ship only in the 7MH4950-1AK01 and 7MH4950-2AK01 configuration packages, which include the FB source, the SIWATOOL U commissioning tool, the HMI integration, and the device manual. Without the package you must implement the SFB52/SFB53 record calls yourself and convert the integer gross to engineering units in your application code.
What is the difference between SFC59 and SFB52 on a S7-300?
SFC59 RD_REC is a system function that is part of the CPU operating system image and is called directly. SFB52 RDREC is a system function block that lives in the STEP 7 standard library and requires an instance DB. Both perform the same acyclic read of a module data record. SFB52 is the modern, library-managed call and is the recommended path on every S7-300/400 CPU, including the 6ES7315-2AG10-0AB0 running FW V2.6.11.