Troubleshooting S7-1200 SM 1231 AI 4-20mA Input Reading 32767

David Krause13 min read
S7-1200SiemensTroubleshooting
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

Troubleshooting S7-1200 SM 1231 AI 4-20mA Channel Reading 32767 (0x7FFF)

An SM 1231 analog input on a SIMATIC S7-1200 PLC returns the raw value 32767 (0x7FFF) regardless of whether a 4-20 mA signal is present, open, or shorted. On the S7-1200 / S7-1500 platform, 32767 is the wired-or overflow sentinel that the analog driver writes when it cannot convert the input to a valid signed-16 code. The most common root causes, in field order, are:

  1. Reversed current-loop polarity (positive leg of the loop landed on the negative input terminal).
  2. Measurement range configured in TIA Portal as 0-10 V while the loop is in fact 4-20 mA (or vice versa).
  3. Channel diagnostics enabled but a broken wire, missing 24 V loop supply, or missing shunt.
  4. Loop-powered (2-wire) transmitter wired as if it were a 4-wire device.
  5. CPU in STOP, module not configured, or wrong slot / wrong module in the device configuration.

This article walks through the diagnostic procedure, the 4-20 mA scaling rules, and the TIA Portal V15 / V16 / V17 configuration steps that resolve 32767 on a 0-6 m level probe connected to an SM 1231 AI module.

Affected Hardware and Firmware

Component Catalog Number Notes
CPU 1215C DC/DC/DC 6ES7215-1AG40-0XB0 (FW 4.x) or 6ES7215-1AG40-0XB0 (FW 4.4+) Firmware 4.2 or higher recommended for full 1231 diagnostics.
SM 1231 AI4 x 13 bit 6ES7231-4HD32-0XB0 Supports +/-10 V, +/-5 V, +/-2.5 V, 0-20 mA, 4-20 mA.
SM 1231 AI4 x 16 bit 6ES7231-5ND32-0XB0 Adds +/-1 V, +/-0.5 V, +/-0.25 V and 0-20 mA / 4-20 mA with 16-bit resolution.
SM 1231 AI8 x 16 bit 6ES7231-5PA30-0XB0 / 6ES7231-5PA40-0XB0 8-channel variant. Same 4-20 mA scaling (0 = 4 mA, 27648 = 20 mA).
SM 1231 AI4 x RTD/TC 6ES7231-5QD32-0XB0 / 6ES7231-5QF32-0XB0 Thermocouple/RTD only; does not accept 4-20 mA directly.
The 6ES7231-4HD32-0XB0 is the lowest-cost AI module and is the one most often on the bench when 32767 appears. Confirm the module is an "AI" not "RTD/TC" variant; thermocouple modules report 32767 for any current input.

Refer to the SIMATIC S7-1200 Programmable Controller System Manual, edition 09/2021 or later, for the official module list and the input range table.

SM 1231 AI Signal Range and Raw-Value Mapping

The SM 1231 quantises a 4-20 mA loop into a signed 16-bit integer. The full mapping, identical to S7-300/S7-400, is shown below.

Current at Terminal Raw Value (INT) Meaning
< 1.185 mA (wire break with diagnostics on) 32767 Overflow / open wire
> 22.81 mA (overdrive) 32767 Overflow
22.81 mA 32511 Overrange end
20.0 mA 27648 Nominal full scale (100 %)
10.0 mA 13824 Mid scale (50 %)
4.0 mA 0 Nominal zero (0 %)
3.999 mA -1 Underrange start (negative count)
1.185 mA -32768 Underrange end
< 1.185 mA (diagnostics off) 0 Clamped to zero
Important: 32767 is a positive number. It is not the result of bad scaling; it is the driver telling the application that the ADC could not produce a valid code. Reading 32767 on every scan almost always means "no current is flowing in the correct direction through the input shunt." Polarity, missing loop supply, or wrong measurement type in the hardware config are the three usual suspects.

Root Cause Analysis: Why 32767 Appears

1. Reversed Loop Polarity

An SM 1231 AI4x16 bit measures the current that flows into the positive terminal and out of the negative terminal. If the loop supply feeds the negative terminal first, the internal differential amplifier saturates and the channel returns overflow. Field evidence shows that with the wiring inverted, the transmitter still receives the correct 24 V across its own terminals (and therefore still drives the loop), but the SM 1231 cannot sense the current direction and reports 32767. Correct wiring for a 4-wire or 2-wire loop is:

  • 4-wire transmitter (own supply): Transmitter "+" -> SM 1231 "+" -> SM 1231 "-" -> Transmitter "-" (signal return). The 24 V power to the transmitter is a separate pair.
  • 2-wire (loop-powered) transmitter: 24 V supply "+" -> Transmitter "+" -> Transmitter "-" -> SM 1231 "+" -> SM 1231 "-" -> 24 V supply "-". The current flows through the AI shunt.

2. Wrong Measurement Type in TIA Portal

If the channel is set to "Voltage +/-10 V" or "Voltage 0-10 V" but a current loop is wired in, the high-impedance voltage input sees the compliance voltage of the transmitter (typically 12-24 V) and the ADC overflows. The hardware configuration must match the electrical signal: 4-20 mA for current loops, 0-10 V for voltage probes. A 510 ohm resistor across a voltage input will not turn a current loop into a voltage input reliably; the SM 1231 has a dedicated internal shunt for 4-20 mA ranges and the gain stage is different from the voltage path.

3. Wire Break / Open Loop

With "Wire break" diagnostics enabled in the channel properties, an open loop is reported as 32767. The diagnostic LED on the SM 1231 also lights. Insert a 4-20 mA process calibrator in place of the transmitter to confirm the input itself is healthy.

4. Loop Supply Missing

For a 2-wire (loop-powered) probe, the SM 1231 does not source 24 V. An external 24 V supply must provide the loop voltage. Typical field wiring: 24 V "+" -> probe "+" -> probe "-" -> AI "+" -> AI "-" -> 24 V "-". If the supply is missing, the probe has no compliance voltage and the current collapses below 1 mA, again producing 32767 with diagnostics on.

5. Module Not in RUN or Not Configured

If the CPU is in STOP, the AI module is unconfigured, or a different slot is addressed in the user program, the input word will read 32767 (or 0) on every scan. Check the device view, the module diagnostics, and the I/O address in the watch table.

Wiring Topologies: 4-Wire vs 2-Wire Loop-Powered

4-Wire Transmitter (Active Output)

The transmitter has its own 24 V power terminals and a separate, isolated current output. The SM 1231 only needs to sink the 4-20 mA. The transmitter positive terminal ties to the AI positive terminal; the transmitter negative terminal ties to the AI negative terminal. Shield is grounded at the panel gland only.

[24 VDC SUPPLY] ----+   +---- [TX V+] [TX V-]
                    |   |
                    +-(+)-+-- [TX OUT+] --
                                    |
                              [AI 0+]  [SM 1231]
                              [AI 0-]  (channel 0)
                                    |
                              [TX OUT-]
                    +---- [0 VDC REF] ----+

2-Wire Loop-Powered Transmitter (Most Level Probes)

Most hydrostatic level probes are loop-powered. The PLC does not source 24 V to the probe; the external 24 V supply sources both the probe and the AI shunt in series.

[24 VDC] ----+   +---- [PROBE +]  [PROBE -]
            |   |
            +   +---------+        |
            |             |        |
            |          [AI 0+]  [SM 1231]
            |          [AI 0-]
            |             |        |
            +-------------+--------+
            |
         [0 VDC REF]
If the loop-powered probe is wired with the AI "+" terminal between the supply and the probe (instead of between the probe and the supply return), current flows backwards through the AI shunt and the channel reads 32767. Move the AI "+" lead to the probe return side of the loop.

TIA Portal V15 Channel Configuration

  1. Open the project, expand the device tree, and double-click the SM 1231 module.
  2. Select channel 0 (or whichever channel the probe is wired to).
  3. In the properties pane, set Measurement type = Current.
  4. Set Range = 4 to 20 mA.
  5. Enable Diagnostics for "Wire break" if you want 32767 to indicate an open loop rather than 0.
  6. Leave Smoothing at the default (none) for the first test, raise it later if the reading is noisy.
  7. Compile the hardware configuration and download to the CPU.
  8. Create a Watch Table (or force the input into a VAT) and read the IW address (e.g. IW96 for slot 1 of an S7-1215).

If the channel is set to Voltage with 510 ohm resistor as a hack to read 4-20 mA, the linearity is poor and the input impedance is mismatched to the transmitter. Use the dedicated 4-20 mA range; the SM 1231 contains an internal 250 ohm shunt for that range. The 510 ohm resistor on a 0-10 V input is at best a stop-gap, not a calibration.

Scaling Raw Counts to Engineering Units (0-6 m)

For a level probe where 4 mA = 0 m and 20 mA = 6 m, the engineering equation is:

Level_m = (Raw_Value / 27648.0) x (Level_Max - Level_Min) + Level_Min
Level_m = (Raw_Value / 27648.0) x 6.0

Key constants for the SM 1231 4-20 mA range:

Parameter Value Note
Zero (4 mA) 0 counts Live zero, not negative.
Span (20 mA) 27648 counts Standard S7 scaling.
Overrange end 32511 counts ~22.81 mA. Still valid code.
Overflow 32767 counts Open wire / overdrive / wrong polarity.
Underrange start -1 count ~3.999 mA.
Underrange end -32768 counts ~1.185 mA.

SCL Scale Function Block with Error Handling

The SCL network below normalises a 0-27648 raw value to the engineering range, treats slight below-zero noise as 0, and latches an error flag for overrange and overflow conditions.

FUNCTION_BLOCK FB_ScaleLevel
VAR_INPUT
  Raw_Value : INT;        // e.g. IW96
END_VAR
VAR_OUTPUT
  Value     : REAL;       // engineering units, 0.0 .. 6.0 m
  Error     : BOOL;       // TRUE on overflow / wire break / polarity fault
END_VAR
VAR
  Min, Max : REAL := 0.0;
  MaxLevel : REAL := 6.0;
END_VAR
BEGIN
  IF Raw_Value > 32512 THEN            // overflow: 32767 or any value above overrange
    Error := TRUE;
    Value := 0.0;
  ELSIF Raw_Value < 0 THEN             // slight underrange noise, treat as zero
    Error := FALSE;
    Value := Min;
  ELSE
    Error := FALSE;
    Value := Min + (INT_TO_REAL(Raw_Value) / 27648.0) * (MaxLevel - Min);
  END_IF;
END_FUNCTION_BLOCK

Use FB_ScaleLevel in OB1 (or a cyclic OB) with the appropriate IW address. The output value at 4 mA will be 0.000 m, at 12 mA will be 3.000 m, and at 20 mA will be 6.000 m. At 32767 the Error flag latches and the Value holds 0.0, which is safe for a level indication that should not display a fake 6 m when the probe is open.

Loop-Powered Sensor Wiring Reference Diagram

24 VDC SUPPLY PSU 24V +24V LEVEL PROBE (2W) 4..20 mA AI0+ AI0- 0V REF Current flows: 24V -> Probe -> AI0+ -> AI0- -> 0V

Current direction is left to right through the probe, then through the SM 1231 AI0+ to AI0- internal shunt, and back to the supply 0 V reference. Reversing the AI leads reverses the current through the shunt and the channel overflows.

Step-by-Step Diagnostic Procedure

  1. Confirm the module part number. Read the label on the side of the SM 1231. If it is a 6ES7231-5QD32 or 6ES7231-5QF32 (RTD/TC), it cannot read 4-20 mA and the value 32767 is expected. Replace with an AI module.
  2. Confirm the measurement type in the device configuration. Open the SM 1231 properties and verify the channel is set to Current / 4-20 mA. If it was previously set to Voltage, recompile and download.
  3. Verify the loop supply. With a multimeter in series, measure the loop current at the AI terminals. You should see 4-20 mA. If you see 0 mA, the 24 V supply is missing or the probe is unpowered.
  4. Verify polarity. Disconnect the AI leads. Place the multimeter in mA mode in series with the AI "+" lead. If the reading is positive, polarity is correct. If the reading is negative, swap the AI leads.
  5. Substitute a 4-20 mA calibrator. Disconnect the probe and connect a process calibrator set to 12.000 mA. The SM 1231 should read 13824 counts.
  6. Read the diagnostics buffer. In TIA Portal, online > diagnostics > diagnostics buffer. A wire break or module fault produces an entry with a 16# diagnostic code.
  7. Force the CPU to RUN. In STOP, the AI image is not updated. Confirm the green RUN LED is on and the error LED on the SM 1231 is off.
  8. Inspect the watch table. Add the IW address of the channel and read it online. 32767 with a calibrator connected confirms a polarity or configuration fault. 0 with a calibrator connected confirms a missing 24 V loop supply.

Common 4-20 mA Error Conditions on the SM 1231

Symptom Likely Cause Action
32767 with probe connected Reversed polarity, missing 24 V, wire break Verify wiring, supply voltage, polarity
32767 with process meter sourcing 4-20 mA Meter not in series, current not flowing through AI shunt Wire meter in series with AI "+" lead
0 with probe connected, probe locally OK Channel configured 0-20 mA, wrong terminal on shunt Reconfigure to 4-20 mA, verify terminal
Stable 27648 but no level change Probe shorted or saturated at full scale Check probe, depressurise, re-range
Counts jitter +/-50 with calm tank No shielding, no smoothing, EMI from VFD Use shielded cable, enable smoothing
-32768 Reverse polarity on certain firmware with diagnostics on Swap AI leads
Counts ramp slowly from 0 to 27648 but never reach full Loop supply droops under load, undersized PSU Use a 24 V supply rated >= probe + loop budget

Verification Checklist

  • Channel measurement type = Current, range = 4-20 mA in TIA Portal hardware config.
  • CPU in RUN, SM 1231 SF / BF LEDs off.
  • Multimeter in series with the loop reads 4-20 mA, never below 3.6 mA at the live-zero.
  • With a process calibrator set to 4.000 mA, the input reads 0 counts. At 20.000 mA, it reads 27648 counts.
  • With the probe installed, the IW address is between 0 and 27648 (or up to 32511 if the tank exceeds 6 m).
  • The SCL block returns a value in metres between 0.0 and 6.0 and the Error flag is FALSE.

Preventive Wiring Practice

Mark every analog conductor at both ends. Use twisted-pair shielded cable with the shield landed at the panel gland only. Keep analog runs in a separate conduit from 480 V VFD output cables. Document the AI module's input range, terminal layout, and the engineering unit scaling in the same drawing as the loop. After any hardware change, re-verify the live-zero at 4 mA with a calibrator before trusting the level indication.

Field-Proven Caveats

  • Some hydrostatic level probes need a minimum 12 V compliance at the probe terminals, not at the supply. Long cable runs drop voltage; check the loop voltage at the probe under load.
  • The SM 1231 AI input impedance is < 250 ohm on the 4-20 mA range. Some 4-wire transmitters need 500 ohm or higher burden; verify the spec.
  • Do not parallel two SM 1231 inputs to a single transmitter. The current will divide and both channels will read half scale.
  • When the CPU is in STOP, AI inputs freeze at the last value; they do not return 32767 unless the diagnostics are explicitly enabled and triggered.

FAQ

What does raw value 32767 mean on an S7-1200 SM 1231 4-20 mA input?

32767 (0x7FFF) is the overflow sentinel. The SM 1231 writes this when the ADC cannot produce a valid signed-16 code: typically an open loop, overdrive above ~22.8 mA, or current flowing in the wrong direction through the input shunt. Treat it as "no valid current reading" and investigate wiring, supply, and configuration before trusting the engineering value.

Can I read 4-20 mA on a 0-10 V input with a 510 ohm resistor?

Technically yes for a quick bench check, but it is not a calibration. The SM 1231 contains a dedicated 250 ohm shunt and a matched gain stage for the 4-20 mA range. Use the 4-20 mA measurement type for production; the resistor hack gives poor linearity, drifts with temperature, and loads the transmitter.

What is the correct wiring for a 2-wire (loop-powered) 4-20 mA level probe on the SM 1231?

24 V supply "+" -> probe "+" -> probe "-" -> AI "+" -> AI "-" -> 24 V supply "-". The current must flow into the AI "+" terminal. Reversing the AI leads causes the channel to read 32767 even though the probe is still powered.

How do I scale a 0-27648 raw value to 0-6 metres in SCL?

Value_m := (INT_TO_REAL(Raw_Value) / 27648.0) * 6.0. Clamp raw values < 0 to 0 (live-zero noise) and treat raw > 32512 as an error flag because the loop is either broken or out of range.

Does the S7-1200 source 24 V for a loop-powered probe?

No. The SM 1231 is a passive receiver; it does not source loop power. An external 24 V supply sized for the probe's compliance voltage and the loop burden is required. For a 4-wire transmitter with its own supply, the AI simply sinks the 4-20 mA signal output.

Back to blog