Using Siemens FC105 to Read PT100 RTD Values in S7-300 PLCs

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

Using Siemens FC105 to Read PT100 RTD Values in S7-300 PLCs

PT100 RTD sensors are the workhorse of industrial temperature measurement on Siemens S7-300/S7-400 automation cells. When the RTD is wired directly into a Siemens analog input module such as the 6ES7331-7PF01-0AB0 SM331 (8AI, 16-bit, RTD/TC capable), the module already linearizes the platinum curve and the peripheral input word (PIW) carries temperature × 10 in degrees. Under that condition you do not actually need FC105 (SCALE) at all: a 4-step ladder sequence (ITD, DTR, load 10.0, /R) reproduces the FC's output. FC105 is required only when the analog signal is a non-temperature quantity delivered as 0–10 V, 0–20 mA, 4–20 mA, or bipolar ±10 V. This reference covers both paths, plus a custom FC that tolerates the small negative raw count and overrange signals you will encounter in the field.

Engineering rule of thumb: If the analog module is configured as RTD/PT100 in HW Config (Step 7) and you see values like 123, 254, -153 in the PIW, that is already °C × 10. Do not feed those raw words into FC105 — you will get a nonsense engineering value because FC105 expects the standard ±27648 normalization, not a pre-linearized temperature word.

1. Prerequisites

Before you wire or code anything, verify that the following hardware and software are on the bench:

  • CPU: S7-300 (CPU 314, 315-2 DP/PN, 317-2, 319-3 PN/DP) or S7-400. The block set is identical because FC105/FC106 are part of the standard library, not the CPU firmware.
  • Analog input module: For direct PT100 wiring, use one of the following SM331 modules with RTD support: 6ES7331-7PF01-0AB0, 6ES7331-7PF11-0AB0, 6ES7331-7HF01-0AB0, or 6ES7331-1KF02-0AB0 (the latter requires external conversion). Cross-check the exact article number against the Siemens SIMATIC S7-300 Module Data manual.
  • PT100 probe: Class A or Class B, 4-wire connection preferred. With 2-wire sensors, add jumpering per module manual and accept the lead-resistance error.
  • Step 7 (Classic): V5.5 or V5.6 with the "Standard Library — TI-S7 Converting Blocks" FC105/FC106 installed. TIA Portal V15+ uses the IEC block family "SCALE" / "NORM_X" / "SCALE_X" instead, but the math is identical.
  • Cabling: Use shielded twisted pair, ground the shield at the cabinet entry only. Siemens recommends a separator (e.g., 6ES7392-1AM00-0AA0) between analog and digital conductors within the same duct.

2. How a Siemens PT100 Channel Is Linearized

The SM331 RTD modules embed a constant-current source that excites the PT100 with approximately 1 mA through a precision reference resistor. The differential voltage across the PT100 is digitized to 16 bits. The module's firmware then applies the ITS-90 platinum table and writes the result into the PIW as a signed integer equal to 0.1 × temperature in degrees Celsius:

Physical Temperature PT100 Resistance PIW value (decimal) PIW value (hex)
-50.0 °C 80.31 Ω -500 0xFE0C
0.0 °C 100.00 Ω 0 0x0000
25.0 °C 109.73 Ω 250 0x00FA
100.0 °C 138.51 Ω 1000 0x03E8
400.0 °C 247.09 Ω 4000 0x0FA0
850.0 °C 390.48 Ω 8500 0x2134

Because the SI unit conversion has already happened inside the module, the FC105 "HI_LIM" / "LO_LIM" parameters must be expressed in temperature × 10 if you still want to feed the PIW into FC105. Set HI_LIM = 8500.0 and LO_LIM = -2000.0 for a standard -200 °C to +850 °C PT100 channel. That said, the more efficient method is the direct ladder conversion covered in Section 4.

3. FC105 (SCALE) Block Reference

FC105 is the legacy Siemens block that converts a raw integer analog count into a floating-point engineering value using the linear equation:

OUT = ((FLOAT(IN) - LO_LIM_IN) / (HI_LIM_IN - LO_LIM_IN)) × (HI_LIM - LO_LIM) + LO_LIM

The library supplies two I/O templates: the original FC105 (returns an INT at OUT, retains the 16-bit packing) and the FC105 "REAL" variant distributed with newer library versions. Always verify which one is in your project — the FC105 in the "Standard Library → TI-S7 Converting Blocks → FC105" returns a REAL. Inputs and outputs:

Parameter Type Description Required Value (PT100 example)
EN BOOL Block enable — pass a constant TRUE if you call FC105 unconditionally TRUE
IN INT Raw analog word. Must be an INT, not WORD. Use MOVE WORD→INT first if the symbol is declared as WORD. PIW 288
HI_LIM REAL Engineering value at maximum input 8500.0
LO_LIM REAL Engineering value at minimum input -2000.0
BIPOLAR BOOL TRUE = bipolar range, FALSE = unipolar TRUE (PT100 goes negative)
RET_VAL WORD Error word. W#16#0000 = OK; W#16#0008 = HI_LIM ≤ LO_LIM; W#16#8101 = input out of range Monitor in VAT
OUT REAL Scaled engineering value (°C × 10 in PT100 case) MD 200

The internal limits used by FC105 are fixed: ±27648 for bipolar, 0–27648 for unipolar. The HI_LIM/LO_LIM parameters only specify what those extremes correspond to in engineering units. This is critical — if your raw value ever exceeds 27648 (overrange) or is below -27648, FC105 outputs the saturation limits and sets RET_VAL = W#16#8101. Field experience with PT100 on 6ES7331-7PF01 is that this is rare because the RTD table is clamped at the module, but with 4–20 mA loops you will see it often.

4. Direct PT100 Conversion Without FC105 (Recommended Path)

For a directly wired PT100 channel this is the cleanest, most reliable implementation. It does not require the SCALE library, has no error code to decode, and is one CPU scan faster because FC105's internal branches are skipped.

4.1 STL Implementation (S7-300/400)

// Network 1: Convert PT100 PIW to REAL (degrees C)
L     PIW 288        // Process Input Word from SM331 RTD channel 0
ITD                  // Convert INT to DINT (handles negative temperatures)
DTR                  // Convert DINT to REAL
L     1.000000e+001  // Load constant 10.0 (real literal in STEP 7)
/R                  // Divide temperature_x_10 by 10.0
T     MD 200         // MD200 now holds °C as REAL

The ITD instruction is mandatory even if the PIW will never go negative on a specific process. If you skip it and the input ever drops below 0, the word-to-real promotion treats the value as an unsigned 16-bit integer and you will see +32767.x instead of -0.x. Always include ITD.

4.2 LAD/FBD Implementation

Drag the four boxes in order: MOVE (INT→DINT) → DI_TO_REALDIV_R with constant 10.0 on IN2 → output to an MD or DB tag of type REAL. The FBD version reads almost identically and is preferred for readability on service calls.

4.3 SCL (Structured Control Language) Implementation

// Function or FB input
// i_raw : INT  -- PIW value
// r_tempC : REAL -- output temperature in degrees C

r_tempC := INT_TO_REAL(i_raw) / 10.0;

SCL automatically widens INT to REAL with the correct sign, so no intermediate ITD is needed. The compiled code is the same as the STL path.

5. FC105 Conversion for 4–20 mA or 0–10 V Signals

When the PT100 is wired through a temperature transmitter that outputs 4–20 mA (Burkert, WIKA, Rosemount, Endress+Hauser all use this output), or when the same SM331 channel is configured for voltage/current in HW Config, FC105 becomes useful. The raw count from the module follows the Siemens standard:

Signal Raw range PIW at scale minimum PIW at scale maximum
0–10 V Unipolar 0 27648
0–20 mA Unipolar 0 27648
4–20 mA Unipolar (with 1 V = 16 counts offset) 0 (≈4 mA) 27648 (20 mA)
±10 V Bipolar -27648 +27648
±20 mA Bipolar -27648 +27648

5.1 FC105 Call Example — PT100 via 4–20 mA Transmitter, 0–200 °C

// In OB1 or a cyclic FB (call conditional or unconditional)
CALL  FC105
     IN        :=  PIW 290         // INT from 4-20 mA channel
     HI_LIM    :=  2.000000e+002   // 200.0 °C at 20 mA
     LO_LIM    :=  0.000000e+000   // 0.0 °C at 4 mA
     BIPOLAR   :=  FALSE           // 4-20 mA is unipolar
     RET_VAL   :=  MW 100          // error word (W#16#0000 = OK)
     OUT       :=  MD 204          // result in °C, type REAL

Note the deliberate choice of LO_LIM = 0.0. If you instead used -200.0 for LO_LIM to "match the PT100 range", FC105 would interpret the 4 mA offset incorrectly and read 4 mA as -200 °C. Always tie LO_LIM/HI_LIM to the engineering units corresponding to the electrical endpoints, not to the PT100's intrinsic range.

5.2 Using FC105 with Bipolar ±10 V Inputs

Set BIPOLAR = TRUE. IN will be in the range -27648…+27648. The formula internally becomes:

OUT = ((FLOAT(IN) + 27648.0) / 55296.0) × (HI_LIM - LO_LIM) + LO_LIM

RET_VAL = W#16#8101 indicates the raw value was outside ±27648. This is informational, not fatal — the OUT pin will still be saturated at HI_LIM or LO_LIM.

6. Custom FC for Under/Overrange and 4–20 mA Drift

FC105 saturates aggressively: any input below 0 on a unipolar 4–20 mA channel will return LO_LIM. In practice, instruments drift slightly below 4 mA at the bottom end (a healthy transmitter can output as low as 3.6 mA per NAMUR NE43), producing small negative raw counts (e.g., -200 to -800). FC105 clips those to LO_LIM and you lose visibility into a degrading sensor. The custom FC below preserves the linear range plus a 10% over/under-range window and reports the underrange as a boolean:

FUNCTION FC 200 : VOID
// ============================================================
//  Convert PIW (INT) to engineering units with under/overrange
//  tolerance. Designed for S7-300/400, works on S7-1500 too.
// ============================================================
VAR_INPUT
    I_PIW      : INT;     // raw analog value
    I_MINIMUM  : REAL;    // engineering value at 0 / 4 mA / -10 V
    I_MAXIMUM  : REAL;    // engineering value at 20 mA / 10 V
END_VAR
VAR_TEMP
    t_Relative : REAL;
    t_Span     : REAL;
END_VAR
VAR_OUTPUT
    O_Engineering : REAL; // result in engineering units
    O_Underrange  : BOOL; // TRUE if raw < 0 (4-20 mA) or < -27648 (bipolar)
    O_Overrange   : BOOL; // TRUE if raw > 27648 or > +27648
END_VAR

BEGIN
    // Unipolar path: assume 4-20 mA or 0-10 V
    IF I_PIW < 0 THEN
        O_Underrange := TRUE;
        t_Relative   := 0.0;
    ELSIF I_PIW > 27648 THEN
        O_Overrange := TRUE;
        t_Relative  := 1.0;
    ELSE
        O_Underrange := FALSE;
        O_Overrange  := FALSE;
        t_Relative   := INT_TO_REAL(I_PIW) / 27648.0;
    END_IF;

    t_Span        := I_MAXIMUM - I_MINIMUM;
    O_Engineering := t_Relative * t_Span + I_MINIMUM;
END_FUNCTION

For bipolar inputs, change the divisor to 55296.0 and the offset term to 27648.0. Calling this FC in OB1 with a 100 ms cycle (OB35) is a common field pattern that avoids loading the OB1 scan while keeping the underrange alarm current.

7. Wiring and Module Configuration Notes

7.1 HW Config Channel Setup (Step 7 V5.6)

  1. Open HW Config and double-click the SM331 module.
  2. Select the channel group (e.g., channel 0–1 for 6ES7331-7PF01).
  3. Set "Measurement type" = RTD or RTD-4L (4-wire).
  4. Set "Resistance thermometer" = Pt 100 (Standard) (IEC 60751 α = 0.00385). For American curves use "Pt 100 (climatic)" (α = 0.00392).
  5. Set "Temperature unit" = Celsius (the linearization always runs in °C; Fahrenheit display is the HMI's job).
  6. Set "Temperature coefficient" = 0.00385 Ω/Ω/°C unless the probe datasheet specifies otherwise.
  7. Activate the channel by checking the "Enable" box. Unchecked channels return 7FFFh and trigger a wire-break if monitored.
Wire break detection: The module reports wire break by driving the PIW to 0x7FFF = 32767. Always mask the PIW against 16#7FFF in your conversion logic and raise a diagnostic alarm — feeding 32767 into the FC105 divider yields a temperature readout near 3276.7 °C which will trip any safety interlock downstream.

7.2 2-Wire vs 4-Wire Compensation

A 2-wire PT100 connection is acceptable for short lead runs (< 3 m) where copper resistance is negligible compared to the measurement resolution you need. For longer runs, a 4-wire Kelvin connection cancels lead resistance. The SM331 RTD modules support both natively; the difference is whether the I+/I- current terminals are tied together (2-wire) or driven separately (4-wire). For high-accuracy applications see the Texas Instruments "Basic Guide to RTD Measurements" application note (Rev. A) which provides the ratiometric measurement fundamentals and a reference design showing how a 4-wire topology suppresses lead resistance errors below 0.05 °C.

8. Commissioning Procedure and Verification

  1. Visual: With the CPU in STOP, open the module's "Monitor/Modify" dialog in HW Config and confirm the PIW reads 0 (or ambient °C × 10) with the PT100 shorted at the terminals.
  2. Short-circuit test: Insert a 100 Ω 0.1% precision resistor (or a decade box set to 100.00 Ω) across the input. Read PIW; the result must be 0 ± 1 count for the SM331-7PF01.
  3. Decade box sweep: Step from 80 Ω to 400 Ω in 10 Ω increments. Compare PIW/10 against the ITS-90 reference table. Acceptable error is ±0.3 °C for a Class A probe, ±0.8 °C for Class B.
  4. FC105 saturation check: For a 4–20 mA transmitter loop, force 4.000 mA from a calibrator. The PIW must read 0 ± 5 counts; FC105 OUT must equal LO_LIM within 0.1% of span. Force 20.000 mA — OUT must equal HI_LIM. Force 24.000 mA (overrange) — RET_VAL must equal W#16#8101 and OUT must equal HI_LIM.
  5. Watchdog: Add a comparison of the PIW against 7FFFh. If true, latch a wire-break tag and suppress the engineering output.

9. Cascading with PID / Heater Control

Once the temperature is in °C (REAL), you can feed it into the standard PID control block FB58 (formerly FB41 in older libraries) or a custom PID implementation. For simple bang-bang heater control on small ovens, a hysteresis ladder is sufficient and protects contactors from rapid cycling:

// Network 1: Heater OFF above setpoint
L     MD 200           // Actual temperature (REAL, °C)
L     MD 220           // Setpoint (REAL, °C)
>R
R     Q 0.0            // Heater output OFF when temp > setpoint

// Network 2: Heater ON below (setpoint - hysteresis)
L     MD 220           // Setpoint
L     MD 224           // Hysteresis (REAL, e.g. 1.0 °C)
-R
L     MD 200           // Actual temperature
>R
S     Q 0.0            // Heater output ON when temp < setpoint - hysteresis

For multi-stage heaters (e.g., 3 zones of 6 kW), subdivide the PID output into bands. The cascade eliminates the harmonic chatter that single-element on/off control exhibits on slow thermal systems:

PID Output Band Heater 1 Heater 2 Heater 3
0% OFF OFF OFF
1–32% OFF OFF OFF
33–65% ON OFF OFF
66–99% ON ON OFF
100% ON ON ON

Field results on a 6-heater wire-wash bath: control band stayed within ±1 °C of setpoint over an 8-hour shift, with each contactor cycling no more than 30 times per hour — well inside the manufacturer's mechanical life rating.

10. Cross-Reference: TIA Portal Equivalent

If you migrate to a S7-1200/S7-1500 controller and TIA Portal V15+, FC105 is replaced by the IEC blocks NORM_X and SCALE_X in the "Convert" library. The parameter mapping is:

Step 7 Classic FC105 pin TIA Portal IEC equivalent Notes
IN (INT) VALUE (INT/LREAL depending on overload) Pre-convert with INT_TO_REAL
HI_LIM MAX (LREAL of SCALE_X) Same meaning
LO_LIM MIN (LREAL of SCALE_X) Same meaning
BIPOLAR (BOOL) Handled by choosing MIN/MAX signs No dedicated pin
RET_VAL (WORD) ENO (BOOL) + status code ENO = FALSE on saturation
OUT (REAL) OUT (LREAL) Double precision by default

Use the formula SCALE_X(MIN:=..., MAX:=..., VALUE:=NORM_X(...)). The behavior on overrange is identical to FC105 — saturation plus an error indicator — so the custom FC200 above is worth porting to a TIA FB if you need underrange visibility on 4–20 mA loops.

11. Common Errors and Diagnostic Matrix

Symptom PIW value Likely cause Corrective action
Temperature reads 3276.7 °C constant 0x7FFF (32767) Wire break or unconfigured channel Check wiring, re-enable channel in HW Config
Temperature reads -200 °C constant -32768 or near Wire break on 2-wire configuration, or sensor wired with reversed polarity Verify polarity against module wiring diagram
Temperature drifts 2-3 °C with ambient changes Normal count, oscillating 2-wire lead resistance not compensated Switch to 4-wire, or use a transmitter with 4-20 mA output
FC105 RET_VAL = W#16#8101 on 4-20 mA <0 or >27648 Sensor below 4 mA (healthy drift) or above 20 mA (overrange) Replace sensor or use custom FC200
FC105 RET_VAL = W#16#0008 HI_LIM ≤ LO_LIM Reverse parameter assignment
Temperature reads inverted (sign wrong) Reasonable count, wrong sign Missing ITD before DTR; raw word treated as unsigned Insert ITD, verify symbol is INT not WORD
FC105 OUT is always LO_LIM regardless of input Negative count BIPOLAR = FALSE on a negative-going signal Set BIPOLAR = TRUE or correct the transmitter offset
CPU goes to STOP on OB1 call FC105 not loaded in project; STL code accessing PIW before module is parameterized Re-distribute hardware, verify "Module is parameterized" OB82 error is clear

12. FAQ

Do I always need FC105 for PT100 on a Siemens S7-300?

No. If the SM331 module is configured as "RTD" or "RTD-4L" in HW Config, the module already linearizes the ITS-90 platinum curve and the PIW is temperature × 10 in °C. Use the direct ladder path (ITD → DTR → /10.0). FC105 is only required when the analog signal is a voltage or current from a transmitter or another sensor type.

What is the difference between FC105 and FC106 in the Step 7 library?

FC105 (SCALE) converts an analog INPUT word (PIW) into a REAL engineering value. FC106 (UNSCALE) is the inverse — it converts a REAL engineering value into a raw analog OUTPUT word (PQW) for an SM332 output module. They are mirror images; the parameter set and error codes are identical.

Why does my PIW read 7FFFh (32767) and the temperature looks wrong?

7FFFh is the SM331 wire-break / overflow indication. The channel may be unconfigured, the PT100 may be open, or the RTD resistance is out of range (typically > 400 Ω for Pt 100). Check HW Config to confirm the channel is enabled, then verify the physical sensor with a multimeter. Always mask the PIW against 7FFFh before any scaling operation to avoid feeding an absurd value into a downstream control loop.

Can FC105 handle negative raw counts on a 4–20 mA loop?

FC105 with BIPOLAR = FALSE clips any negative IN to LO_LIM and returns RET_VAL = W#16#0000 (no error reported). This is misleading because a healthy 4–20 mA transmitter drifts below 4 mA per NAMUR NE43 and you will lose visibility into sensor degradation. Use the custom FC200 in Section 6 if underrange detection matters for your application.

What RTD probe classes are supported by the SM331-7PF01 module?

The 6ES7331-7PF01-0AB0 supports Pt 100, Pt 200, Pt 500, Pt 1000, Ni 100, Ni 1000, and Cu 10 in 2-, 3-, and 4-wire configurations per IEC 60751 and DIN 43760. For higher accuracy with long lead runs, see the Analog Devices "Positive Analog Feedback Compensates PT100 Transducer" article which discusses error sources and linearization trade-offs for transmitter-based designs.

Back to blog