Scaling PT100 4-20mA Signals on S7-300 with FC105 and FC106

David Krause13 min read
S7-300SiemensTechnical Reference
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

Scaling PT100 4-20mA Signals on S7-300 with FC105 and FC106

Overview

This reference documents the correct use of Siemens STEP 7 standard-library blocks FC105 (SCALE) and FC106 (UNSCALE) to read a 2-wire PT100 temperature transmitter with a 4-20 mA output on an S7-300 analog input module (e.g. SM331) and re-emit the scaled temperature as a 0-10 V signal on an analog output module (e.g. SM332). The target mapping is:

  • 0 °C → 4 mA at the input → 0 V at the analog output
  • 100 °C → 20 mA at the input → 10 V at the analog output

The same engineering-unit range (0.0 to 100.0 °C, REAL) is used at both the input and the output, which makes a direct raw-count passthrough viable in many cases. Where intermediate engineering units are required (PID blocks, HMI tags, math functions, range clipping, or asymmetric spans), FC105 and FC106 provide the canonical Siemens solution and are present in every STEP 7 V5.x installation under Standard Library → TI-S7 Converting Blocks.

PT100 Transducer Signal Chain Fundamentals

A PT100 RTD changes resistance with temperature: 100 Ω at 0 °C, approximately 138.5 Ω at 100 °C (3850 ppm/K platinum curve per IEC 60751). A 2-wire loop-powered PT100 transmitter:

  • Integrates the RTD bridge, linearization lookup, and a 4-20 mA current-loop driver.
  • Is powered from the analog input's 24 V loop supply (or an external DC supply on the transmitter's power terminals).
  • Outputs a current proportional to temperature, with 4 mA representing the lower range value (LRV) and 20 mA representing the upper range value (URV).
Always confirm the transmitter's calibrated span. Some PT100 transmitters are factory-set to 0-200 °C, -50 to +150 °C, or -50 to +400 °C. The HI_LIM/LO_LIM values in FC105/FC106 must match the calibrated engineering-unit span, not the marketing label printed on the housing.

Current-loop signaling is preferred over voltage because the receiving instrument sees only the loop current, not the cable resistance. This eliminates lead-resistance errors that plague a 2-wire RTD connected directly to a voltage-measuring input. For high-accuracy work, 3-wire and 4-wire RTD connection is used at the transmitter's input terminals to cancel lead resistance; this is internal to the transmitter and does not change the 4-20 mA output side discussed here.

S7-300 Analog I/O Hardware Selection

For a single 4-20 mA input and a single 0-10 V output, the typical hardware choices are:

Module Order Number (6ES7-) Channels Range Resolution
SM331 AI8x12Bit 331-7KF02-0AB0 8 AI ±10 V, 0-10 V, 4-20 mA (per channel) 12 bit
SM331 AI8x13Bit 331-1KF01-0AB0 8 AI ±10 V, 0-10 V, 4-20 mA 13 bit
SM332 AO4x12Bit 332-5HD01-0AB0 4 AO ±10 V, 0-10 V, 4-20 mA 12 bit
SM334 AI4/AO2x8Bit 334-0CE01-0AB0 4 AI / 2 AO 0-10 V only (no 4-20 mA on input) 8 bit

The SM334 combined module is too limited for this application because its inputs do not support 4-20 mA. Use a discrete SM331 for the PT100 transmitter and a discrete SM332 for the 0-10 V output, or use the integrated AI4/AO2 on a CPU 31xC if it supports the required ranges. Refer to the SIMATIC S7-300 Module Data manual for the full channel-by-channel range list and the slot-by-slot address map.

Configure the measuring range on the SM331 using the channel-side DIL switch on older revisions or with STEP 7 Hardware Config on newer modules. The 4-20 mA range corresponds to the “D” type measurement and must be selected before commissioning; mixing a 0-10 V setting with a 4-20 mA transmitter produces an input that under-scales by 40 % and never exceeds 60 % of full scale.

Raw Count Representation: 4-20 mA and 0-10 V Ranges

Siemens S7-300 analog I/O modules normalize every range to a signed 16-bit raw count. For unipolar ranges the mapping is:

Range 0 % Raw Count 100 % Raw Count Resolution
4-20 mA 4 mA 0 20 mA 27648 ~0.578 µA / count
0-10 V 0 V 0 10 V 27648 ~361.7 µV / count
0-20 mA 0 mA 0 20 mA 27648 ~0.723 µA / count
±10 V -10 V -27648 +10 V +27648 ~361.7 µV / count
The 4-20 mA input uses an offset: 4 mA is represented as 0, not as -6928 as a naive bipolar scaling would imply. This is intentional so that FC105 can map 0 counts to LO_LIM engineering units. A current below 4 mA under-ranges the channel and reports negative raw counts (down to -32768 for wire-break on most SM331 revisions). Configure FC105 with BIPOLAR=FALSE so these under-range values are not mis-scaled into negative temperatures.

FC105 SCALE Block Parameters

FC105 reads a 16-bit raw value at input IN and produces a REAL engineering-unit value at output OUT according to:

OUT = ((FLOAT(IN) - 0) / (27648 - 0)) × (HI_LIM - LO_LIM) + LO_LIM

for unipolar (BIPOLAR=FALSE) operation. The complete parameter list for this application:

Parameter Type Description Value for This Application
IN INT Raw analog input (PIW) PIW 272
HI_LIM REAL Engineering units at 27648 counts (20 mA) 100.0
LO_LIM REAL Engineering units at 0 counts (4 mA) 0.0
BIPOLAR BOOL TRUE for ±27648 range, FALSE for 0-27648 FALSE
RET_VAL WORD Error code (0 = OK) MW 2
OUT REAL Scaled engineering value MD 100

FC105 returns the following error codes in RET_VAL when the scaled result cannot be represented:

RET_VAL (hex) Meaning
W#16#0000 No error
W#16#0008 Result below LO_LIM (negative input with BIPOLAR=FALSE)
W#16#0108 Result above HI_LIM (over-range input)

Select FC105 in the STEP 7 program editor and press F1 for the integrated context-sensitive help, which contains the parameter table and the exact scaling formula for both bipolar modes.

FC106 UNSCALE Block Parameters

FC106 is the inverse of FC105: it accepts a REAL engineering value at IN and produces the 16-bit raw count at OUT that maps to the corresponding analog output level:

OUT = (FLOAT(IN) - LO_LIM) / (HI_LIM - LO_LIM) × 27648 (BIPOLAR=FALSE)

The result is clipped to 0-27648 (or to -27648 / +27648 in bipolar mode). FC106 parameters for this application:

Parameter Type Description Value for This Application
IN REAL Scaled engineering value MD 100
HI_LIM REAL Engineering units at 27648 counts (10 V) 100.0
LO_LIM REAL Engineering units at 0 counts (0 V) 0.0
BIPOLAR BOOL FALSE for unipolar 0-10 V output FALSE
RET_VAL WORD Error code MW 4
OUT INT Raw analog output (PQW) PQW 282

Note the symmetry of HI_LIM/LO_LIM with FC105: because the analog output's 0-10 V range maps 1:1 with the input's 0-100 °C engineering-unit span, both blocks use 0.0 and 100.0 as their limits. The 10 V at full scale is a property of the SM332 output channel's voltage range, not of the engineering units. FC106 is range-agnostic with respect to the analog card's voltage or current type; only the 0-27648 raw-count ceiling is fixed.

Working Ladder Logic Implementation

The complete, verified LAD/STL implementation in four networks. Slot numbering assumes slot 4 = SM331 (PIW 272-287) and slot 5 = SM332 (PQW 272-279). Adjust if your rack configuration differs.

Network 1 — Buffer the raw analog input

      L     PIW 272          // 4-20 mA raw value from PT100 transmitter
      T     MW 200           // INT buffer for FC105

Network 2 — FC105 scale to engineering units

      CALL  FC 105
           IN       := MW 200
           HI_LIM   := 100.0
           LO_LIM   := 0.0
           BIPOLAR  := FALSE
           RET_VAL  := MW 2
           OUT      := MD 100

Network 3 — FC106 unscale to raw output

      CALL  FC 106
           IN       := MD 100
           HI_LIM   := 100.0
           LO_LIM   := 0.0
           BIPOLAR  := FALSE
           RET_VAL  := MW 4
           OUT      := PQW 282

Network 4 (alternative) — Direct raw-count passthrough

      L     PIW 272
      T     PQW 282          // Mirror raw input to raw output

Compile the FC105/FC106 calls with the LAD/FBD editor so STEP 7 inserts the instance call with the symbol names; do not hand-code the FB call with absolute addresses only, because FC105 enforces specific parameter types (REAL for the limits). Place the calls inside OB1 or in OB35 (cyclic interrupt at 100 ms) so MD100 is refreshed every scan.

Common Pitfalls and Root Causes

3.1 Wrong limit value type (REAL vs INT)

If HI_LIM is loaded as an integer literal (e.g. 100 instead of 100.0), STEP 7 still coerces it to REAL on the call boundary, but the engineer can be confused about the meaning. The common mistake is to set FC106's HI_LIM to 10 (thinking of 10 V full scale) instead of 100.0 (thinking of 100 °C full scale). FC106 does not know whether its output drives a 0-10 V or 4-20 mA card; the HI_LIM and LO_LIM are always in engineering units, and the 27648 ceiling is hard-wired in the block. Always document the units next to the limit value in the symbol comment.

3.2 Wrong bipolar flag

Setting BIPOLAR=TRUE on the 4-20 mA input causes FC105 to expect a raw input range of -27648 to +27648. The actual input range is 0 to +27648 (with 4 mA mapped to 0). FC105 will then scale 4 mA to -50 °C and 20 mA to +50 °C, exactly half the intended span. Always set BIPOLAR=FALSE for both the 4-20 mA input and the 0-10 V output.

3.3 Reading the wrong PIW

Slot numbering: the analog input module's PIW address depends on its slot in the S7-300 rack. Slot 4 (the first signal module in a CPU 31x rack) typically maps to PIW 256 + (slot - 4) × 16 for an 8-channel module. For slot 5, channel 0 maps to PIW 272. Verify the address with HW Config → Module Properties → Addresses. Reading a different slot's PIW returns either constant zero or another process signal, not the PT100 input.

3.4 Output channel not configured for 0-10 V

The SM332 AO4x12Bit (6ES7 332-5HD01) has channel-specific output-type selection via DIL switch on the module side. If the channel is set to 4-20 mA, writing 27648 still produces 20 mA, not 10 V. Likewise, an unused channel defaults to “deactivated” and outputs 0 V (or 0 mA) regardless of the raw count written. Always check the channel-side DIL switch against the planned range before applying field power.

3.5 Forgetting FC106 entirely

A common first attempt is to write MD100 directly to PQW 282 with L MD100 / T PQW 282. This fails to compile cleanly because T PQW expects a 16-bit source and MD100 is a 32-bit REAL. Even if the compiler accepted it, MD100 holds a value like 73.5 °C, and writing that as a raw count would produce 73.5 mV on a 0-10 V output, not 7.35 V. FC106 (or the direct raw-count passthrough in Network 4) is required to put a 16-bit scaled value on the PQW.

Direct Copy Shortcut (When Ranges Match)

Because the 4-20 mA input maps to 0-27648 raw counts and the 0-10 V output also maps to 0-27648 raw counts, and the engineering-unit span is identical at both ends (0-100 °C), the entire signal chain can be replaced with a single load/transfer:

      L     PIW 272
      T     PQW 282

This is functionally correct only when LO_LIM at the input equals LO_LIM at the output (0 °C → 4 mA → 0 V) and HI_LIM at the input equals HI_LIM at the output (100 °C → 20 mA → 10 V). If the transmitter has a different span (e.g. -50 to +200 °C, or 0-150 °C), the shortcut silently produces wrong voltages and the FC105/FC106 path is mandatory. The shortcut also eliminates the scaled REAL value at MD100, so any HMI tag or PID block that needs the engineering-unit reading must use a separate FC105 instance.

PID Loop Integration Notes

If the scaled REAL value at MD100 feeds a PID block such as FB41 (CONT_C) or FB58 (TCONT_CP) from the Standard Library:

  1. FB41 expects a real-valued process variable (PV_IN) and a real-valued setpoint (SP_INT). MD100 from FC105 can be wired directly to PV_IN.
  2. The PID output is a percentage (0.0 to 100.0) representing a valve position or similar. To convert that back to a 0-10 V output, use FC106 with HI_LIM=100.0 and LO_LIM=0.0 — the same configuration shown above; the only difference is the source of MD100 (FC105 from the PT100 input, or FB41's LMN output).
  3. If the FB41 output is wired to a positioner or actuator with a 4-20 mA input, change the output module to a 4-20 mA channel and the FC106 scaling stays identical; the 27648 raw-count ceiling is consistent across current and voltage outputs.

When the PID's setpoint or process variable is clamped (e.g. anti-windup at the LMN_HLM/LMN_LLM), use the FC105/FC106 path so that MD100 reflects the same engineering-unit space as the clamp values. Avoid mixing raw-count values with REAL percentage values in the same arithmetic expression.

Commissioning and Verification

  1. Apply a known input. Substitute the PT100 with a calibrated mA source (e.g. 12.000 mA = 50 °C). Verify the reading in MD100 = 50.0 ±0.1 with a STEP 7 VAT table.
  2. Apply open-circuit input. Confirm the SM331 reports a negative raw count (typically -32768 or -32767 with diagnostic bits) and that FC105 RET_VAL reports W#16#0008. Use this as the wire-break alarm condition.
  3. Apply short-circuit input. 0 mA should report the same under-range raw count and FC105 should clamp MD100 at 0.0 °C.
  4. Measure the analog output with a DMM at the field terminals: at 0 °C input expect 0.000 V ±10 mV; at 100 °C expect 10.000 V ±10 mV.
  5. Verify monotonicity. Ramp the mA source from 4 to 20 mA in 1 mA steps. MD100 must increase monotonically by 6.25 °C per mA, and PQW 282 must increase monotonically by 1728 counts per °C (27648 / 100 × 6.25 ÷ 6.25 = 1728 counts per °C at 4-20 mA ↔ 0-100 °C).
  6. Check wiring. Confirm shield grounding at one end only, that the analog cable is routed away from VFD power cables, and that the 24 V loop supply for the transmitter is sized for the transmitter's maximum load (typically 20 mA × 24 V = 0.48 W).
  7. Cross-check the SM331/SM332 DIL switches against the planned 4-20 mA input and 0-10 V output types.

FAQ

Why use 100.0 as HI_LIM in FC106 when the output is 10 V?

FC106's HI_LIM and LO_LIM are always engineering units, not volts or milliamps. The 27648 raw-count ceiling is hard-wired in the block; FC106 assumes the output card maps 0 → 0 V (or 4 mA) and 27648 → full scale (10 V or 20 mA). Use 100.0 because 100.0 °C is the engineering-unit value you want to correspond to 10 V at the field terminals.

Can I skip FC105 and feed PIW 272 directly to FC106?

Only if the engineering-unit span of the input (0-100 °C here) matches the engineering-unit span of the output (0-100 °C here). In that case a direct L PIW 272 / T PQW 282 also works because both raw-count ranges are 0-27648. Use FC105/FC106 whenever you need a readable engineering value, diagnostic clamping, a different span at one end, or a REAL tag for a PID block or HMI.

What does FC105 do when the input current drops below 4 mA?

The SM331 reports negative raw counts (down to -32768). With BIPOLAR=FALSE, FC105 returns OUT = LO_LIM and RET_VAL = W#16#0008 (result below LO_LIM). This is the intended diagnostic behavior — the engineering-unit reading clamps at 0 °C and the error word lets the PLC generate a wire-break alarm in OB1 or OB82 (diagnostic interrupt).

Do FC105 and FC106 require a separate library?

Both are in the STEP 7 Standard Library → TI-S7 Converting Blocks library, which is installed with every STEP 7 V5.x installation. In TIA Portal the equivalent blocks are SCALE_X and NORM_X (FC1087/FC1088-style) with the scaling input as REAL. The algorithm and the 27648 ceiling are identical across both generations.

Why is my analog output stuck at 0 V?

Check, in order: (1) the SM332 channel DIL switch is set to voltage (V), not current (I) or deactivated; (2) the correct PQW address is being written (not the diagnostic address); (3) the analog output's load is within the module's rated impedance (≥1 kΩ for voltage outputs); (4) MD100 is being updated each scan — place the FC105 call inside OB1 or OB35 and verify MD100 with a VAT table; (5) FC106 RET_VAL is W#16#0000 (no error).

Back to blog