Scaling WAGO 750-466 4-20 mA Analog Inputs on a Siemens S7-300 CPU 315-2DP over PROFIBUS DP
Engineer field reference for FC105 overflow (raw value 32767), Siemens S7 analog conventions, and custom scaling of WAGO 750-466 process values.
This technical reference documents how to read, interpret, and scale a 4-20 mA process signal coming from a WAGO 750-466 2-channel analog input module, mapped through a WAGO PROFIBUS coupler (e.g., 750-342 or 750-343) into a SIMATIC S7-300 CPU 315-2DP (6ES7315-2AFxx). It addresses the two classic symptoms seen in plant deployments:
- FC105 (SCALE) refuses to scale values above 27648 and latches its output at the configured high limit.
- The raw input word reads 32767 even when the loop is healthy, or the value appears inconsistent with the controller's actual scale.
The article consolidates the Siemens S7 analog value convention, the meaning of 32767 (and -32768), and the WAGO 750-466 channel configuration, then provides drop-in STL, SCL (Structured Text), and LAD alternatives to FC105 that correctly handle PROFIBUS-mapped WAGO input words.
1. System Architecture and Topology
The standard topology combines a Siemens CPU with PROFIBUS-DP master functionality and a WAGO 750-x00 fieldbus coupler that exposes modular I/O on the slave side. For the analog signal in question the topology is:
1.1 Hardware Bill of Materials
| Item | Catalog / Order Number | Function | Notes |
|---|---|---|---|
| SIMATIC S7-300 CPU 315-2DP | 6ES7315-2AF03-0AB0 (or later) | PROFIBUS DP master | Firmware V2.0 or higher recommended for full SFC59 / RD_REC support |
| WAGO 750-466 | 750-466 | 2-channel analog input, 0-20 mA / 4-20 mA, 12-bit | Configurable per channel; supports diagnostics |
| WAGO PROFIBUS coupler | 750-342 or 750-343 | Fieldbus node, GSD file WAGO7531.gsd | Sets PROFIBUS address, baudrate up to 12 Mbit/s |
| STEP 7 V5.5+ | 6ES7810-4CC10-0YA5 | Engineering tool | HW Config with WAGO GSD installed |
| WAGO-I/O-CHECK | Free utility, wago.com | Field module commissioning | Used to validate raw counts before CPU scan |
1.2 PROFIBUS GSD and I/O Address Mapping
After importing the WAGO GSD (file WAGO75xx.gsd, where xx matches the coupler family) into STEP 7, place a 750-466 module into the coupler slot. Each 750-466 occupies 4 bytes of input process image (2 channels x 2 bytes) and no output bytes. Typical address assignment examples:
| WAGO Slot | Module | PIW Address | Bytes | Bit Width |
|---|---|---|---|---|
| Slot 1 | 750-466 Channel 0 | PIW 288 | Low word of DWORD | 16-bit INT |
| Slot 1 | 750-466 Channel 1 | PIW 290 | High word of DWORD | 16-bit INT |
2. Siemens S7 Analog Value Convention
Siemens analog I/O uses a signed 16-bit two's complement representation. For unipolar current inputs (0-20 mA or 4-20 mA) the nominal numeric range is 0 to +27648. For bipolar signals the range is -27648 to +27648. Anything outside that range on a Siemens SM module is reserved for diagnostics.
| Range Class | Raw INT Range | Physical Meaning |
|---|---|---|
| Nominal (unipolar) | 0 to 27648 | 0 to 20 mA (or 4 to 20 mA) |
| Nominal (bipolar) | -27648 to +27648 | -10 to +10 V, -20 to +20 mA |
| Overrange | 27649 to 32511 | Marginal overrange, often still useable after filtering |
| Diagnostic overflow | 32767 (0x7FFF) | Channel diagnostic error active (e.g., wire break, out of range) |
| Diagnostic underflow | -32768 (0x8000) | Channel underrange / diagnostic error active |
Per the Siemens analog module diagnostics documentation, an analog input channel reporting any diagnostic condition returns 32767 (positive side) or -32768 (negative side) regardless of whether the diagnostic interrupt is enabled. This is a platform-level convention, not a manufacturer-specific quirk.
3. Root Cause: Why FC105 Clamps at 27648 and Why 32767 Appears
3.1 FC105 Internal Limits
FC105 (FC for S7-300 / S7-400, equivalent to SCL "Scale" in TIA) implements the formula:
OUT = ((IN - K1) / (K2 - K1)) * (HI_LIM - LO_LIM) + LO_LIM
where for unipolar (BIPOLAR = FALSE) the constants K1 = 0 and K2 = 27648; for bipolar (BIPOLAR = TRUE) K1 = -27648 and K2 = +27648. Internally the function performs integer division and bounds checks:
- If
IN > K2the function setsOUT = HI_LIMand flagENO = FALSE; it does not return 32767 to the OUT tag. - If
IN < K1the function setsOUT = LO_LIMandENO = FALSE.
FC105 was designed assuming a Siemens SM analog module whose valid output never exceeds the nominal range. The WAGO 750-466, in contrast, can return raw counts up to 32767 (the diagnostic overflow value) and a positive overrange up to roughly 32511 (approximately 110 % of 4-20 mA). FC105 silently clamps these, which is the "it just stops running" symptom described in the field.
3.2 The 32767 Reading
If PIW shows 32767, one of three conditions is true:
- The WAGO 750-466 has flagged a channel diagnostic (open wire, short, under/overrange) and is propagating 32767 per the convention in Section 2.
- The transmitter loop current is above 20 mA (e.g., 22-24 mA saturated output), but the WAGO module is reporting 32767 because internal calibration places the saturated value above the diagnostic threshold.
- The PROFIBUS I/O area is byte-swapped; if PIW 288 and PIW 290 are swapped or the high/low byte is reversed, 32767 (0x7FFF) can be a side-effect of reading the wrong word.
ChannelFault and matches the 32767 value at PIW.4. Pre-Flight Verification Before Coding
- Connect WAGO-I/O-CHECK to the coupler via the service port. Force a known 12.000 mA input and read the raw counts. For the 750-466 at 12.000 mA the expected raw count is approximately
27648 * (12 - 4) / 16 = 13824. - Verify the channel operating mode in I/O-CHECK: 4-wire vs 2-wire, 0-20 mA vs 4-20 mA, and whether diagnostics are enabled. For 4-20 mA applications, set the channel to 4-20 mA, diagnostics enabled.
- In STEP 7 HW Config, open the 750-466 module. Confirm the analog input type selected matches the field wiring (4-20 mA). If the GSD only offers generic "AI 4-20 mA" the module handles the conversion internally and exposes a raw 0-27648 count, in which case the FC105 limits become irrelevant and the 32767 reading comes purely from a diagnostic flag.
- Insert a VAT (variable monitor table) and watch PIW 288 / PIW 290 on the online CPU. Inject 4 mA, 12 mA, and 20 mA. Confirm linear response between 0 and 27648 counts. If 4 mA already reads 32767, the channel is in diagnostic error, not overrange.
5. Solution A - Custom Scaling FC in STL
FC105 cannot be re-used without modification because its internal constants are hard-coded. A small replacement FC returns a REAL engineering value, exposes an OUT-OF-RANGE status, and clamps only when truly required.
FC20 - Scale_4_20mA (STL implementation)
FUNCTION FC 20 : VOID
TITLE = 'Scale 4-20 mA WAGO 750-466 to engineering units'
AUTHOR : 'PlantEng'
FAMILY : 'ANALOGSC'
NAME : Scale_4_20mA
VERSION : '1.2'
VAR_INPUT
RawInput : INT; // PIW from 750-466, e.g. PIW 288
LoEng : REAL; // Eng value at 4 mA (e.g. 0.0)
HiEng : REAL; // Eng value at 20 mA (e.g. 100.0)
END_VAR
VAR_OUTPUT
EngValue : REAL; // Scaled engineering value
StatusOK : BOOL; // FALSE = wire break, diag, or 32767/-32768
Underrange : BOOL; // < 4 mA threshold (default < 3.6 mA)
Overrange : BOOL; // > 20 mA but not diagnostic
END_VAR
VAR_TEMP
rRaw : REAL;
END_VAR
BEGIN
// 1. Detect Siemens diagnostic placeholder
IF (RawInput = 32767) OR (RawInput = -32768) THEN
EngValue := 0.0;
StatusOK := FALSE;
Underrange := TRUE;
Overrange := FALSE;
RETURN;
END_IF;
// 2. Convert raw to REAL and clamp to [0, 32767]
rRaw := DINT_TO_REAL(INT_TO_DINT(RawInput));
IF rRaw < 0.0 THEN rRaw := 0.0; END_IF;
IF rRaw > 32767.0 THEN rRaw := 32767.0; END_IF;
// 3. Linear scaling: 4 mA -> LoEng, 20 mA -> HiEng
// Siemens 4 mA nominal count = 0, 20 mA nominal count = 27648
EngValue := (rRaw / 27648.0) * (HiEng - LoEng) + LoEng;
// 4. Threshold flags
IF rRaw < 1382.4 THEN // < 3.6 mA: wire break guard
StatusOK := FALSE;
Underrange := TRUE;
Overrange := FALSE;
ELSIF rRaw > 27648.0 THEN // > 20 mA: overrange
StatusOK := TRUE;
Underrange := FALSE;
Overrange := TRUE;
ELSE
StatusOK := TRUE;
Underrange := FALSE;
Overrange := FALSE;
END_IF;
END_FUNCTION
Call from OB1 / OB35:
CALL FC 20
RawInput := PIW 288
LoEng := 0.0
HiEng := 100.0
EngValue := MD100 // REAL out, e.g. percent or engineering unit
StatusOK := M 110.0
Underrange := M 110.1
Overrange := M 110.2
6. Solution B - SCL Implementation in TIA or STEP 7 V5.x
Equivalent SCL source for STEP 7 Professional / TIA Portal:
FUNCTION "Scale_4_20mA_WAGO" : Void
{ S7_Optimized_Access := 'FALSE' }
VERSION : 1.2
VAR_INPUT
RawInput : Int; // PIW e.g. PIW288
LoEng : Real; // eng value at 4 mA
HiEng : Real; // eng value at 20 mA
END_VAR
VAR_OUTPUT
EngValue : Real;
StatusOK : Bool;
Underrange : Bool;
Overrange : Bool;
END_VAR
VAR_TEMP
tRaw : Real;
END_VAR
BEGIN
IF (RawInput = 32767) OR (RawInput = -32768) THEN
EngValue := 0.0;
StatusOK := FALSE;
Underrange := TRUE;
Overrange := FALSE;
RETURN;
END_IF;
tRaw := DINT_TO_REAL(INT_TO_DINT(RawInput));
IF tRaw < 0.0 THEN tRaw := 0.0; END_IF;
IF tRaw > 32767.0 THEN tRaw := 32767.0; END_IF;
EngValue := (tRaw / 27648.0) * (HiEng - LoEng) + LoEng;
IF tRaw < 1382.4 THEN
StatusOK := FALSE; Underrange := TRUE; Overrange := FALSE;
ELSIF tRaw > 27648.0 THEN
StatusOK := TRUE; Underrange := FALSE; Overrange := TRUE;
ELSE
StatusOK := TRUE; Underrange := FALSE; Overrange := FALSE;
END_IF;
END_FUNCTION
7. Solution C - LAD Logic for Engineers Who Prefer Ladder
For those who refuse to leave the LAD editor, the same FC105 replacement fits in two networks.
Network 1: Diagnostic detection and clamp
| [PIW 288 == 32767] OR [PIW 288 == -32768] | ||
| | --[==]--( == )--[==]--| | | | | M 110.0 (StatusOK) := 0 |
| | ---| |-------| |---+ | | | | M 110.1 (Underrange) := 1 |
| | --- PIW 288---- 32767--+ | | | | MD 100 (EngValue) := 0.0 |
| if any: jump to label M001 | ||
Network 2: Linear scaling using the scaled formula
M001: NOP 0
L PIW 288 // Load raw INT
ITD // Convert INT to DINT
DTR // Convert DINT to REAL
L 2.764800e+004 // 27648.0 (REAL divisor)
/R // REAL division
L 1.000000e+002 // HiEng (e.g. 100.0)
*R
T MD 100 // Store scaled value
Add a separate branch to detect < 3.6 mA (raw < 1382) and > 20 mA (raw > 27648) using integer compare instructions (> I and < I) to drive M 110.1 / M 110.2.
8. Using FC105 Anyway (When the Module Truly Outputs 0-27648)
If the WAGO 750-466 is configured through HW Config as "AI 4-20 mA" and the WAGO GSD guarantees that the channel returns 0-27648 by virtue of internal linearization, FC105 can be used directly. The minimal call is:
CALL FC 105
IN := PIW 288
HI_LIM := 100.0
LO_LIM := 0.0
BIPOLAR:= FALSE
RET_VAL:= MW120 // error flag, see FC105 help
OUT := MD 100
However, because FC105 cannot distinguish "input 27648" from "input above 27648", it cannot detect a wire break, which is the main reason field users see a stuck-at-100 % reading after the loop fails. Wrap FC105 with the diagnostic checks from Section 5 (compare PIW to 32767 before calling FC105) to recover lost detection capability.
9. Alternative Scaling - SCALE / UNSCALE Convention (TIA)
The TIA Portal SCALE block replicates FC105, and UNSCALE replicates FC106. Both clamp at the Siemens nominal range and share the FC105 limitations. They are not a substitute for the custom FC above.
| Block | Family | Output Type | Diagnostic Handling |
|---|---|---|---|
| FC105 / TIA SCALE | S7-300/400 | REAL scaled | None - clamps silently |
| FC106 / TIA UNSCALE | S7-300/400 | INT scaled | None - clamps silently |
| Custom FC (Section 5) | Universal | REAL + status | Detects 32767, overrange, underrange |
10. WAGO 750-466 Channel Diagnostics
The 750-466 supports per-channel diagnostics that, when enabled, push the channel raw value to 32767 (-32768) the moment a fault is detected:
| Diagnostic Event | PIW Value | Cause | Field Action |
|---|---|---|---|
| Wire break / open loop | 32767 (above 4 mA) | Loop disconnected, shunt open, transmitter failure | Inspect transmitter, terminals, 24 V loop supply |
| Short circuit | 32767 / -32768 | Short to ground or 24 V in the cable run | Megger cable, inspect junction boxes |
| Overrange | 27649 to 32766 | Input current > 20 mA nominal | Check transmitter scaling; verify primary process variable |
| Underrange | -32768 (negative channel) | Input current < nominal low (e.g. < 4 mA for 4-20 mA) | Loop power supply, transmitter zero |
| No fault | 0 to 27648 | Healthy operation | None |
10.1 SFC59 / RD_REC for WAGO Status
The WAGO coupler implements standard PROFIBUS DP-V0 diagnostics. To read the WAGO module status register from STEP 7:
CALL SFC 59 "RD_REC"
REQ := TRUE
IOID := B#16#54 // Input area
LADDR := W#16#120 // Logical base address of WAGO coupler
RECNUM := B#16#00 // Slot 0 = coupler diagnostic
RET_VAL := MW 200
BUSY := M 210.0
RECORD := P#M 220.0 BYTE 64 // Target buffer, 64 bytes
Bytes 7-9 of the WAGO diagnostic record contain the channel-level status bits. Decode them per the WAGO 750-466 manual to verify that the 32767 value coming from PIW 288 corresponds to a flagged diagnostic condition rather than a measurement artifact.
11. Hardware Configuration in HW Config
- Install the WAGO GSD file (
WAGO7531.gsd) via HW Config > Options > Install GSD File. - Insert a WAGO 750-342 (or 750-343) coupler at the PROFIBUS address set on the rotary switches (e.g., address 3).
- Insert the 750-466 module into the coupler slot.
- Double-click the module, set the channels to 4-20 mA, diagnostics enabled.
- Verify I/O addresses. The default starting address depends on existing PROFIBUS slaves; record PIW values and document in the project header.
- Compile and download HW Config.
12. Wiring and Shielding
The WAGO 750-466 supports 2-wire and 4-wire transmitters. Default is 2-wire with the module supplying loop power (24 V from the coupler power contacts). For a typical 2-wire loop:
13. Commissioning Checklist
| # | Step | Expected Result |
|---|---|---|
| 1 | Apply 24 V to WAGO coupler power contacts | Power LED green, I/O LEDs per module |
| 2 | Force transmitter to 4.000 mA | PIW 288 = 0 (or 1382 if 3.6 mA threshold is engaged) |
| 3 | Force transmitter to 12.000 mA | PIW 288 = 13824 |
| 4 | Force transmitter to 20.000 mA | PIW 288 = 27648 |
| 5 | Disconnect loop wire | PIW 288 = 32767; StatusOK = FALSE; Underrange = TRUE |
| 6 | Apply FC20 from Section 5 to PIW 288 | EngValue = expected engineering units, StatusOK TRUE at healthy loop |
| 7 | Inspect CPU diagnostic buffer for WAGO entries | No diagnostic entries at healthy loop; "Channel fault" event on break |
| 8 | Verify PROFIBUS cycle time | Bus cycle < 5 ms (typical), watchdog 10 ms |
14. Troubleshooting Matrix
| Symptom | Likely Cause | Diagnostic | Fix |
|---|---|---|---|
| PIW 288 = 32767 always | Wire break, no loop power, channel in diagnostic error | Measure mA at terminals with handheld mA meter | Restore loop, check 24 V supply, check transmitter fuse |
| PIW 288 = 27648 always | Transmitter saturated or output shorted to 20 mA reference | Compare PIW with handheld meter | Inspect process variable, replace transmitter |
| PIW 288 = random noise around mid-range | Unshielded cable, ground loop, EMI | Check shield termination; check cabinet ground | Re-route cable, ground shield at cabinet entry only |
| PIW 288 = 0 at 20 mA input | Channel configured for 0-20 mA but loop current is 4 mA; or wiring reversed | Verify channel mode in WAGO-I/O-CHECK | Reconfigure channel to 4-20 mA, swap A0 terminals |
| FC105 output stuck at HI_LIM | PIW 288 > 27648 (FC105 cannot scale above) | Compare FC105 OUT to PIW 288 online | Replace FC105 with FC20 (Section 5) or wrap FC105 with diagnostic clamp |
| PROFIBUS station failure | Wrong GSD, address conflict, baudrate mismatch | CPU diagnostic buffer, SFC13 diagnostic read | Reinstall GSD, set coupler address to match HW Config |
| PIW 288 byte-swapped (e.g., reads 0xFF7F = 65407) | Module occupies DWORD but address slot misaligned | Check HW Config slot order | Realign slot, or apply byte-swap in user program |
15. Common Pitfalls
- Assuming the WAGO module outputs 0-27648. It outputs 0-27648 nominal, 27649-32511 overrange, and 32767 / -32768 for diagnostics. Code that ignores the high range cannot distinguish a healthy 24 mA overrange from a wire break.
- Calling FC105 with uninitialized PIW. If the WAGO station has failed, PIW retains the last value, which may be 32767 from a prior diagnostic event. Always check the PROFIBUS slave status before scaling.
- Mixing INT and DINT/REAL. The ITD instruction must precede DTR. Skipping ITD in STL produces a sign-extension bug.
- Forgetting to enable diagnostics on the 750-466. Diagnostics are optional; without them, the module will not report a wire break as 32767, and the user program must rely purely on a 4 mA < raw < 20 mA check to detect open loops.
- Using FC105 with bipolar=TRUE on a 4-20 mA signal. The constants become -27648 to +27648, which yields wrong scaling for a unipolar current loop.
16. Field Notes
Across multiple S7-300 retrofits where a 750-466 replaces a legacy Siemens SM 331, the dominant field issue is the misreading of 32767 as "value" rather than "diagnostic". Operators who saw a controller freeze at 100 % after a wire break usually traced it back to FC105 silently clamping. The custom FC in Section 5 (or its SCL counterpart) is a drop-in fix that survives STEP 7 / TIA upgrades.
For new deployments, prefer WAGO 750-466 modules whose GSD entry exposes "AI 4-20 mA, diagnostics enabled" and route the resulting raw counts through the FC20 block before they reach HMI faceplates. For retrofits of older 750-466 firmware (pre 2018) that lack per-channel diagnostic enable, the alternative is to rely on the underrange threshold (raw < 1382) to flag wire break without using the 32767 convention.
17. Frequently Asked Questions
Why does FC105 stop scaling at 27648?
FC105 (and the TIA SCALE block) hard-codes the Siemens S7 nominal analog range. For unipolar signals (BIPOLAR = FALSE) the upper limit is 27648. Any raw input above 27648 causes FC105 to clamp the output to HI_LIM and set ENO = FALSE. Use a custom FC (Section 5) to scale values above 27648 and detect diagnostic placeholders.
What does raw value 32767 mean on a Siemens analog input?
32767 (and -32768) is the Siemens-defined diagnostic overflow/underflow placeholder. Per the Siemens analog module diagnostics documentation, any channel with a diagnostic error (wire break, short, out-of-range) returns 32767 (positive side) or -32768 (negative side) regardless of whether the diagnostic interrupt is enabled. Treat 32767 as a fault, not a measurement.
Can I use FC105 for a 4-20 mA WAGO 750-466 input?
Yes, provided the WAGO module is configured for 4-20 mA and the channel returns 0-27648 nominal. Wrap FC105 with a pre-check for PIW = 32767 to retain wire-break detection. For full diagnostic handling, replace FC105 with the FC20 from Section 5.
How do I detect a wire break on a 4-20 mA loop without diagnostics enabled?
Monitor PIW for raw counts < 1382 (approximately 3.6 mA, the wire-break threshold). Flag StatusOK = FALSE when raw < 1382, hold the last good value or substitute a substitute value, and raise an HMI alarm. This works on legacy 750-466 firmware that does not push 32767.
Does the 750-466 occupy PROFIBUS addresses differently than a Siemens SM 331?
Yes. The 750-466 is mapped through a WAGO coupler (750-342 or 750-343) and consumes 4 bytes of input process image (2 channels x 2 bytes). A Siemens SM 331 in the same PROFIBUS rack directly occupies its assigned PIW address. Confirm PIW assignment in HW Config and document it in the project header.