Home / Knowledge Base / Energy Meters

How to Fix Modbus Error 01 (Illegal Function) on Eastron & REAL Registers

ERROR 16#8186 / EXCEPTION 01 TARGET: Eastron SDM630/SDM120, ABB, Siemens S7-1200/1500, SCADA
⚡ TL;DR Diagnostic Quick-Card
Symptom:
Static integer registers read fine. Polling Float32/REAL registers (kWh, kW, V, A) triggers connection drop or error flags.
Error Codes:
Modbus Exception 01 (Illegal Function) | Siemens PLC 16#8186 | Modbus Poll Error 01
Root Cause:
Master is using Function Code 03 (Read Holding). Eastron enforces Function Code 04 (Read Input) for dynamic REAL measurements.
Diagnostic Log (Modbus Poll / Siemens TIA Portal Buffer)
Tx: [01] [03] [00] [00] [00] [02] [C4] [0B]  (Master querying Address 30001 with FC 03)
Rx: [01] [83] [01] [80] [F0]                 (Slave rejects with Exception 01)

System Fault: Modbus Exception Code 01 (Illegal Function Code)
Siemens TIA Portal Status: 16#8186 (MB_MASTER: Function code not supported by remote device)

Why Does This Happen? (The Protocol Trap)

Modbus RTU standards describe memory as four separate tables. Most modern devices allow you to read all registers using Function Code 03 (Holding Registers). IEC compliant power meters like Eastron are very strict about the traditional Modbus boundaries.

They define dynamic electrical measurements (Voltage, Current, Power, Energy) strictly as read-only Input Registers. When your PLC or SCADA software sends a standard FC 03 query for a floating-point address, the meter’s firmware immediately aborts the transaction and returns Exception Code 01. You must query these specific registers using Function Code 04 (Read Input Registers).

Option A: The Free Engineering Fix (Step-by-Step)

You do not need new hardware to fix a standalone meter. You must configure your polling master to route float queries through Function Code 04.

Step 1: Verify with Modbus Poll (PC Verification)

Before modifying PLC logic, isolate the hardware. Open Modbus Poll or Modscan on your laptop:

  1. Go to Setup -> Read/Write Definition.
  2. Change Function from 03 Read Holding Registers to 04 Read Input Registers.
  3. Set Address to 0 (for Eastron SDM630 Phase 1 Voltage) and Length to 2.
  4. The error 01 will instantly disappear, confirming the physical layer is healthy.

Step 2: Siemens TIA Portal (ST) Code Modification

In Siemens PLCs, the MB_MASTER or Modbus_Master instruction block relies on memory offsets to dictate the outgoing Function Code.

💻 Siemens S7-1200 / S7-1500 Structured Text (ST) Fix Verified Field Code
// WRONG: 4xxxx address offset forces TIA Portal to generate Function Code 03
// MB_MASTER.DATA_ADDR := 40001; -> Causes 16#8186 Error on Eastron floats

// CORRECT: Forcing Function Code 04 via 3xxxx address offset
MB_MASTER_Instance(
    REQ := Read_Trig,
    MB_ADDR := 1,                  // Slave ID
    MODE := 0,                     // Mode 0 = Read
    DATA_ADDR := 30001,            // CRITICAL: 30000 + Register 1 = Forces FC 04
    DATA_LEN := 2,                 // 2 Words = 32-bit Floating Point (REAL)
    DATA_PTR := P#DB10.DBX0.0 REAL // Target REAL buffer in Data Block 10
);
💡 Why 30001? Eastron manuals list registers starting at address 0x0000. Siemens TIA Portal uses 1-based offset indexing where 40001 triggers FC 03 and 30001 triggers FC 04. To read Eastron register 0 with FC 04, you must input address 30001.

Step 3: The Next Trap — Solving Garbled Float Numbers (Endianness)

As soon as you switch to Function Code 04, Error 01 will go away. But 90% of engineers face a new problem immediately: the read value is a meaningless string of garbage data (like -1.854e+30 instead of 230.5V).

This is a Word Order / Endianness mismatch. A 32-bit REAL float consists of two 16-bit Modbus registers. Eastron transmits the high word first (CDAB or Big-Endian), while your PLC or SCADA might expect little-endian (ABCD or BADC).

Free Diagnostic Tool: Stop guessing byte orders

No need to spend hours recompiling PLC code to test different byte swappers. Paste your raw Hex payload into our free tool and see immediately which Endianness format (CDAB, ABCD, BADC, DCBA) decodes into the correct electrical reading.

Launch Float Endianness Decoder →
Device / SoftwareExpected Float Byte OrderRequired Action in PLC / SCADA
Eastron SDM SeriesCDAB (High Word, Low Word)Native transmission format.
Siemens S7-1200/1500ABCD / Big-EndianUse SWAP instruction or complex byte-shift SCL script.

Why Software Polling Breaks Down at Scale (The Architecture Reality)

Custom ST routing scripts and writing manual endianness swapping logic (SWAP) for a single PLC cabinet reading two meters is barely acceptable. But for distributed energy systems, solar microgrids, or factory retrofits, depending on the central PLC to do this physical Modbus translation creates severe architectural bottlenecks:

⚠️ The PLC Cycle Time & Bus Locking Bottleneck

1. Scan Cycle Degradation: Flipping between FC03 for legacy inverters and FC04 for Eastron meters, whilst calculating real-time byte swapping across 100+ floats, bloats the PLC’s main scan cycle time tremendously.

2. Single-Master Bus Locking: RS485 is a half-duplex bus. If an EMS gateway attempts to read the same meter network simultaneously with the local PLC, data packets collide, corrupting the telemetry loop entirely.

Option B: Edge Protocol Offloading (The Architect’s Solution)

To prevent PLC CPU bloat and eliminate manual byte-swapping, professional systems integrators decouple the OT serial network from the IT/SCADA network using an autonomous Modbus Protocol Offloading Gateway.

❌ Standard PLC Serial Polling
  • PLC CPU wastes clock cycles waiting for slow 9600bps serial responses.
  • Programmer must hand-code FC03/FC04 routing and complex float byte-swapping.
  • High vulnerability to bus collisions when adding secondary SCADA monitoring.
✅ Valtoris Edge Offloading Gateway
  • Zero PLC CPU Load: Gateway polls RS485 autonomously and caches data in high-speed local memory.
  • Hardware-Level Byte Swapping: Web UI maps FC04 and flips CDAB to ABCD automatically. Outputs clean 32-bit floats.
  • Multi-Host Buffer: PLC and Cloud SCADA read clean JSON or Modbus TCP over Ethernet at sub-3ms speeds without bus contention.

Stop Wasting PLC CPU Cycles on Serial Parsing

Hardware acceleration for Modbus RTU polling, floating-point endian conversion, and function code routing. Valtoris Edge Gateways provide an autonomous communication bridge delivering clean, standardized data over Ethernet to your PLCs and SCADA servers—ensuring zero bus collisions and lightning-fast scan cycles.