Scaling K-Type Thermocouple on S7-1200 SM 1231 in TIA Portal V13

David Krause10 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

Scaling K-Type Thermocouple on S7-1200 SM 1231 TC Module in TIA Portal V13 SP1

The SM 1231 thermocouple module (order number 6ES7231-5QF30-0XB0) for the SIMATIC S7-1200 returns a digitally scaled integer that already represents the measured temperature in tenths of a degree. Unlike the 0–27648 normalization used by standard analog inputs, thermocouple channels do not require NORM_X / SCALE_X blocks to obtain engineering units. The conversion factor is fixed: Raw Integer = Temperature (°C) × 10 at 0.1 °C resolution. This reference walks through hardware configuration, raw value interpretation, scaling logic for a 0–1370 °C window, negative temperature handling, and verification on the S7-1200 with TIA Portal V13 SP1.

Scope: This procedure is specific to the SM 1231 TC 8 AI module (6ES7231-5QF30-0XB0) under firmware V4.x of the S7-1200 CPU and TIA Portal V13 SP1 / V14 / V15. The 4-channel variant (6ES7231-5QD32-0XB0) and the RTD module share the same integer format but differ in channel count and diagnostic behavior.

1. Prerequisites

Item Specification
CPU S7-1200, firmware V4.0 or higher (for V13 SP1 project compatibility)
Signal module SM 1231 TC, 8 AI, 6ES7231-5QF30-0XB0
Engineering tool STEP 7 Basic / Professional V13 SP1 (or compatible)
Thermocouple Type K (NiCr-Ni) per IEC 60584-1, ISA Type K
Compensation Internal reference junction (built into the module)
Display range 0 °C to 1370 °C (Type K upper limit per IEC 60584-1)

Reference the SIMATIC S7-1200 Programmable Controller System Manual (entry ID 109751326) and the SM 1231 TC module manual for the channel-by-channel diagnostic layout.

2. Hardware Overview

The SM 1231 TC module provides eight isolated differential inputs for thermocouples of types J, K, T, E, N, R, S, and B. Each channel converts the thermoelectric voltage against the internal reference junction (a Pt1000 sensor at the terminal block) and outputs a 16-bit signed integer. Module-specific characteristics:

Parameter Value
Order number (MLFB) 6ES7231-5QF30-0XB0
Number of channels 8 AI (TC)
Resolution 0.1 °C / 0.1 °F (15-bit + sign)
Update time ~ 200 ms per channel group (4 channels / group)
Common-mode voltage ± 35 V max
Diagnostic interrupt Configurable (wire break, overflow, underflow, reference junction error)
Reference junction Internal (fixed) or external (RTD channel 0)
Resolution note: The 6ES7231-5QF30-0XB0 module reports in 0.1 °C steps by default. The newer 6ES7231-5QF32-0XB0 firmware variant supports an optional 0.01 °C mode using a ×100 multiplier; verify which MLFB is installed before assuming a ÷10 conversion factor.

3. TIA Portal V13 SP1 Hardware Configuration

Insert the SM 1231 TC module to the right of the CPU in the device view. With the module selected, configure each channel in the Properties > Analog inputs inspector pane.

  1. Open the project in TIA Portal V13 SP1 and select the S7-1200 station.
  2. Drag the SM 1231 TC module from the catalog into the device configuration slot next to the CPU.
  3. Click the module, then open Properties > Analog inputs.
  4. For each active channel, set:
    • Measurement type: Thermocouple
    • Thermocouple type: K
    • Temperature unit: Celsius
    • Smoothing: Weak (or as required by the process)
    • Reference junction: Internal
    • Diagnostics: Enable wire break, overflow, underflow
  5. Compile the hardware configuration and download to the CPU.
The Internal reference junction setting uses the module's built-in terminal block temperature sensor. If the wiring distance between module and TC bead is more than a few meters, consider External reference with a Pt100 on channel 0 to compensate for terminal-strip temperature drift.

4. Analog Value Representation for Type K Thermocouples

For the SM 1231 TC at 0.1 °C resolution, the analog input word (IW) carries the temperature multiplied by 10. The format is a 16-bit signed integer (INT), bipolar over the configured thermocouple range.

Measured temperature Raw value (INT) Hex
-200.0 °C -2000 16#F830
-100.0 °C -1000 16#FC18
0.0 °C 0 16#0000
21.3 °C 213 16#00D5
100.0 °C 1000 16#03E8
500.0 °C 5000 16#1388
1000.0 °C 10000 16#2710
1300.0 °C 13000 16#32C8
1370.0 °C 13700 16#3574
Overflow (over-range) 32767 16#7FFF
Underflow (below range) -32768 16#8000
Wire break 32767 (with diagnostic bit) 16#7FFF

This is the same convention used across the ET 200eco PN and ET 200SP TC modules. See the Siemens documentation Representation of Analog Values for Thermocouples for the canonical mapping.

5. Why NORM_X / SCALE_X Are Not Required

The standard NORM_X / SCALE_X ladder blocks assume a 0–27648 (unipolar) or -27648 to +27648 (bipolar) raw range and map it to a user-defined engineering range. TC modules already perform the linearization and scaling in firmware, so applying a second NORM_X / SCALE_X pass double-scales the value and yields nonsense.

Approach Result
÷10 on raw word Engineering units in °C (correct)
NORM_X / SCALE_X with min=0, max=1370 Engineering units in °C × 1370 / 32767 (incorrect, ~ 42× too low)
Direct INT transfer to HMI Value displayed as 213 means 21.3 °C (correct but requires ÷10 at HMI)

Pick one path: either scale in the PLC and send a REAL to the HMI, or send the INT and divide at the HMI tag.

6. Scaling Code for a 0–1370 °C Process Range

If the sensor is bonded to a process that physically spans 0 °C to 1370 °C, the engineering value is simply IW[p] / 10.0. Use SCL or LAD with INT-to-REAL conversion to keep precision.

6.1 SCL Implementation (TIA Portal V13 SP1)

// "Temp_Raw" is an INT mapped to IW96 (first channel of the SM 1231)
// "Temp_Celsius" is a REAL exposed to the HMI
// Channel start address depends on slot position - adjust accordingly

Temp_Celsius := INT_TO_REAL(Temp_Raw) / 10.0;

// Optional: clamp to the 0..1370 process range
IF Temp_Celsius < 0.0 THEN
    Temp_Celsius := 0.0;
ELSIF Temp_Celsius > 1370.0 THEN
    Temp_Celsius := 1370.0;
END_IF;

6.2 LAD / FBD Equivalent

[IW96] --> [INT_TO_REAL] --> [DIV_REAL (10.0)] --> [MD100] "Temp_Celsius"

6.3 Handling Negative Temperatures

The ÷10 conversion is sign-safe because S7-1200 INT is 16-bit two's complement. Division of a negative INT by a positive REAL yields a negative REAL, so 0.1 °C resolution is preserved all the way down to -3276.8 °C (well below the Type K lower limit of -200 °C).

// Read TC channel 0 (raw INT in IW96)
// Convert to engineering units in °C
#Temp_Celsius := INT_TO_REAL(#IW_TC_Ch0) / 10.0;

// Apply process scaling (e.g. 0..1370 °C -> 4..20 mA equivalent at HMI)
#Process_PV := ((
#Temp_Celsius - 0.0
) / (
1370.0 - 0.0
)) * 100.0; // 0..100 %

6.4 Variant: 0.01 °C Resolution (×100)

On modules configured with the higher-resolution mode, replace the divisor:

Temp_Celsius := INT_TO_REAL(Temp_Raw) / 100.0; // 0.01 °C per count
If your HMI shows values 10× lower than expected (e.g., 21 °C instead of 213 °C when the probe is at room temperature), the module is in 0.01 °C mode. Verify in the device configuration under the channel's Resolution property.

7. Wire-Up and Reference Junction

Thermocouple wire must be of the same calibration type (K-type) all the way to the module terminals. Avoid copper intermediate blocks unless a true isothermal terminal with external compensation is used. Polarity for Type K per IEC 60584-1: positive leg is NiCr (yellow in ANSI, green in IEC), negative leg is NiAl.

  • Internal reference: simplest; accuracy ± 1–2 °C near terminal block temperature.
  • External reference (channel 0 as Pt100): required when the module sees wide ambient swings or sits away from the process.
  • Fixed reference value: use this only when the terminal is held at a known temperature (e.g., oven-mounted terminal block).

8. Diagnostic Bits and Error Codes

The SM 1231 TC raises a diagnostic interrupt (OB82) when configured. The diagnostic address word carries error flags; user program typically polls for wire break before trusting the scaled value.

Diagnostic event Typical raw value Recommended action
Wire break 32767 / -32768 Inspect TC bead, terminals, extension wire
Over-range 32767 Verify type-K range; check for noise / ground loops
Under-range -32768 Verify polarity; check for open sensor
Reference junction error 32767 + bit in diag word Recalibrate terminal block sensor; check internal/external setting
Communication failure Module in diagnostic state Check slot, firmware compatibility, ribbon cable seating

9. Verification Procedure

  1. Online monitor: Go online with the CPU and add %IW96 (or appropriate channel) to a watch table. Observe the integer value.
  2. Reference check: Apply a millivolt source equivalent to known Type K temperature (e.g., 4.096 mV ≈ 100 °C for K-type at 0 °C reference). Confirm IW reads 1000 ± a few counts.
  3. Ice-bath test: Submerge the TC bead in a 0 °C slush bath; IW should read 0 ± 2 (terminal-strip error band).
  4. HMI tag: Confirm the HMI tag is bound to the REAL variable, not the raw INT. If the HMI shows a 10× error, the divisor is wrong or the tag is bound to the wrong symbol.
  5. Diagnostic interrupt: Disconnect one TC leg and confirm OB82 fires and the diagnostic bit is set in the module's status word.

10. Troubleshooting Matrix

Symptom Likely root cause Corrective action
Display reads 21.3 when sensor is at 213 °C HMI tag bound to raw INT, no ÷10 Bind HMI to REAL variable or add ÷10 in HMI script
Display reads 2130 instead of 21.3 ×10 applied twice (NORM_X + SCALE_X) Remove NORM_X/SCALE_X; use direct ÷10
Value stuck at 32767 Wire break or over-range Check TC polarity, continuity, reference junction
Value stuck at -32768 Polarity reversed or sensor open Swap TC leads at terminal block
Drift of 5–10 °C over hours Terminal block temperature swing, internal reference error Switch to external Pt100 reference on channel 0
All channels read 0 Module not configured / not downloaded Recompile HW config and download to CPU
IW reads negative when sensor is positive Type-K polarity reversed Swap yellow and red leads per IEC color code
Module flagged as faulty after download Firmware mismatch between module and TIA portal Update module firmware or install correct HSP

11. Common Mistakes

  • Applying 0–27648 NORM_X. TC modules do not return a 0–27648 count. They return degrees × 10 directly.
  • Forgetting the unit suffix. Engineering staff may interpret a value of 213 as 213 °C instead of 21.3 °C. Always label HMI fields with the correct unit and decimal point.
  • Using copper wire between TC and module. This introduces a second reference junction. Use K-type extension wire (KX) all the way to the terminals.
  • Mismatched smoothing vs. update time. Weak smoothing on a 0.5 Hz filter still updates every 200 ms; verify that the control loop can tolerate the noise floor before disabling smoothing.

12. Migration Notes to TIA Portal V14 / V15

If you migrate the project to V14 or V15, the same scaling logic applies. The only field-level change is the addition of the higher-resolution mode on the 6ES7231-5QF32-0XB0 MLFB. Re-verify the channel properties inspector after migration; the slot address (IW96 in this example) does not change unless the slot position changes.

13. Field Commissioning Checklist

  • [ ] Module seated firmly, locking lever down
  • [ ] TC wire color code verified against standard
  • [ ] Channel configured: Type K, °C, smoothing weak, internal reference
  • [ ] Wire-break diagnostic enabled
  • [ ] Hardware compiled and downloaded without errors
  • [ ] HMI tag bound to REAL, decimal places = 1
  • [ ] OB82 attached to diagnostic interrupt
  • [ ] Ice-bath or millivolt source calibration recorded

What raw value does the SM 1231 TC module return for a K-type thermocouple?

The 6ES7231-5QF30-0XB0 module returns a 16-bit signed integer equal to the measured temperature in °C multiplied by 10. A reading of 21.3 °C appears as the integer 213 in the input word (for example IW96). Divide the raw integer by 10.0 to obtain engineering units in °C.

Do I need NORM_X and SCALE_X to scale a thermocouple on the SM 1231?

No. The SM 1231 TC module already performs linearization and scaling in firmware and outputs the temperature × 10 directly. Using NORM_X / SCALE_X with a 0–27648 input range will corrupt the value. A simple INT-to-REAL conversion followed by division by 10 is the correct scaling method.

How are negative K-type temperatures represented in the input word?

The module uses a bipolar 16-bit signed integer. A measurement of -100.0 °C returns the integer -1000. Division of -1000 by 10.0 yields -100.0, so the sign is preserved automatically when the raw word is converted to REAL before division.

Why does my HMI show a value 10 times lower than the actual temperature?

The module is likely configured for 0.01 °C resolution (×100 mode), which is available on the 6ES7231-5QF32-0XB0 variant. Check the channel's resolution property in the device configuration. Change the divisor in your scaling code from 10.0 to 100.0, or revert to 0.1 °C resolution mode.

What does a raw value of 32767 or -32768 mean on the SM 1231 TC?

32767 indicates either an over-range condition or a wire break. -32768 indicates under-range or reversed polarity. Enable diagnostic interrupts (OB82) and read the module's diagnostic status word to distinguish between these conditions and apply the correct corrective action.

Back to blog