Overview
This reference describes how to integrate a SOCOMEC Countis E24 multi-function energy meter into a Siemens LOGO! 8 (BA series) logic module over Modbus TCP. The Countis E24 exposes a 32-bit unsigned integer at Holding Register 50514 representing total active energy. The integration challenge is twofold: the LOGO! Modbus TCP data table only transfers 16-bit words, and the LOGO! analog network input converts those words using signed floating-point semantics, which corrupts unsigned 32-bit values above 32767. The procedure below configures both ends of the link, maps the registers, and applies a byte-swap decode that recovers the correct unsigned count in VM memory.
LOGO! device firmware 8.0 and later supports Modbus TCP as a server (slave) and client (master) on the integrated Ethernet port. The protocol is enabled in LOGO!Soft Comfort from V8.0 onward through the Ethernet connections editor, with the data table (DT) defining the request payload and the parameter VM mapping for the response. Refer to the Siemens application document Modbus/TCP Communication using the Example of SENTRON PAC for the canonical LOGO! client/server model and DT field descriptions.
Prerequisites
- Siemens LOGO! 8 logic module (6ED1052-xxx08-0BA1 or later) with firmware 8.0 or higher. Modbus TCP is not available on LOGO! 6/7 hardware.
- LOGO!Soft Comfort V8.0 or higher installed on the engineering PC.
- SOCOMEC Countis E24 with Ethernet Modbus gateway option, firmware V103.8 or later (Communication Table revision 48503051).
- Ethernet switch or direct crossover cable between LOGO! Ethernet port and Countis E24 RJ45.
- SOCOMEC DIRIS Setup or web configuration interface access to the Countis E24.
- Modbus diagnostic tool (e.g., Modbus Doctor, Modbus Poll) for verifying register reads independently of LOGO!.
SOCOMEC Countis E24 Modbus Interface Configuration
The Countis E24 Ethernet gateway accepts standard Modbus TCP requests on TCP/502. Three parameters must be confirmed before LOGO! integration: the IP address, the Modbus Unit Identifier, and the port. The default Unit Identifier (also called Slave ID) shipped from the factory is 255, which is non-standard for most masters. Reassign to 1 for predictable LOGO! DT behavior.
| Parameter | Default | Recommended | Notes |
|---|---|---|---|
| IP Address | 192.168.1.100 | 192.168.1.100 (static) | Reserve in DHCP scope or assign static. |
| Subnet Mask | 255.255.255.0 | 255.255.255.0 | Match LOGO! subnet. |
| Gateway | 192.168.1.1 | 192.168.1.1 | Required only for remote access. |
| Modbus TCP Port | 502 | 502 | Do not change unless firewall requires it. |
| Unit Identifier | 255 | 1 | 255 causes sporadic NAK on some masters. |
| Byte Order | Big-Endian | Big-Endian (no swap) | Per Countis E24 Modbus Communication Table. |
Apply changes through the Countis E24 web interface at http://192.168.1.100 or via the SOCOMEC DIRIS Setup utility. After the write, power-cycle the meter to ensure the new Unit ID persists.
LOGO! 8 Modbus TCP Communication Setup
In LOGO!Soft Comfort, open the Ethernet Connections dialog and add a new Modbus TCP client-server connection. Define the LOGO! as the Modbus client (master) initiating requests to the Countis E24 server. The data table (DT) row governs each poll.
Data Table Row Definition
Each DT row transfers 1 to 32 words starting at a configurable Holding Register (HR) address. For the total active energy at HR 50514 (32-bit unsigned), configure two consecutive words starting at 50514.
| DT Column | Value | Description |
|---|---|---|
| Enable | On | Activates the row on every scan of the Ethernet block. |
| Type | Read Holding Registers (Function 03) | Countis E24 holds all measurement data in HRs. |
| IP Address | 192.168.1.100 | Countis E24 IP. |
| Port | 502 | Modbus TCP server port. |
| Unit Identifier | 1 | Matches Countis E24 Unit ID. |
| Start Address | 50514 | Per Countis E24 Modbus table (offset -1 applies on some LOGO! firmware revisions; test both 50514 and 50515). |
| Count (Words) | 2 | Captures both halves of the 32-bit value. |
| Destination Start Address | VW0 | VM word area where the two raw words are written. |
| Read Once / Cyclic | Cyclic, 1 s | 1 second is sufficient for energy accumulation display. |
Register Map and Addressing
The Countis E24 Communication Table revision 48503051 defines the register layout. The most-commonly polled registers for total energy are summarized below.
| Register (HR) | Size (words) | Data Type | Unit | Description |
|---|---|---|---|---|
| 50514 | 2 | uint32 BE | kWh × 100 | Total active energy (import + export combined) |
| 50516 | 2 | uint32 BE | kWh × 100 | Partial active energy (resettable) |
| 50520 | 2 | int32 BE | W | Instantaneous total active power |
| 50530 | 2 | uint32 BE | Wh × 10 | Total reactive energy |
| 50540 | 2 | uint16 | V × 10 | Phase 1 voltage |
| 50541 | 2 | uint16 | A × 100 | Phase 1 current |
All multi-register values are big-endian (most significant word at the lower address). The LOGO! DT writes the words in the same order as they arrive over Modbus, so HR 50514 lands in VW0 and HR 50515 lands in VW2 when Count = 2 and Destination Start Address = VW0.
Decoding 32-bit Unsigned Integer Values in LOGO!
The LOGO! analog network input block (AI) interprets its input word as a signed 16-bit value ranging from -32768 to +32767. A LOGO! analog network output (AQ) interpreted as float is similarly limited. Critically, the LOGO! cannot directly cast two 16-bit words into a 32-bit unsigned integer. The supported 32-bit conversions are floating-point (F/I converter) which assume IEEE 754 structure, not integer.
The workaround uses two stages: first read the raw 16-bit words into VM, then assemble the unsigned 32-bit value using arithmetic and analog threshold logic, or display the high and low words separately with scaling on the LOGO! TDE.
Method A — Display High and Low Words Separately
For energy values below 327.67 kWh (where the value fits in 16 bits unsigned, range 0–65535 representing 0–655.35 kWh when scaled × 100), read only HR 50515 (the low word) and apply the analog network input scaling factor of 0.01 to convert counts to kWh. This avoids the 32-bit decode entirely.
VW2 = raw low word from HR 50515
Energy_kWh = AI(VW2) × 0.01
Connect the analog network input (NAI) block to the LOGO! TDE or to the AQ block driving a 4–20 mA output for SCADA telemetry. This is the simplest viable path when the installation is fresh and energy has not yet exceeded 327.67 kWh.
Method B — Full 32-bit Unsigned Decode
For installations that must display the full range (0 to 4,294,967.295 kWh), use a small ladder program that performs unsigned 32-bit addition across the two VM words. The following function block sequence reconstructs the unsigned value into VW10 (low) and VW12 (high) of an auxiliary VM area, with VW10 always representing the lower 16 bits of the unsigned count.
- Add NAI block referencing VW0 (high word from HR 50514). If the high word is negative as a signed value but the energy is positive, the value was originally an unsigned high word above 32767. Multiply the signed reading by 65536 (shift left 16 bits) using a constant multiplier block.
- Add NAI block referencing VW2 (low word from HR 50515). This is always non-negative when interpreted signed because the low word range matches the unsigned low 16 bits.
- Sum the two components using an addition block:
Unsigned32 = (Signed(VW0) × 65536) + VW2 - If the high word is signed-negative (which corresponds to unsigned values from 32768 to 65535), the multiplication by 65536 produces a negative partial result. The arithmetic block must be configured with carry/unsigned semantics, achievable by adding 65536 before multiplying:
Unsigned32 = ((Signed(VW0) + 65536) AND 0x0000FFFF) × 65536 + VW2
For practical deployments, the LOGO! Soft Comfort math blocks and the new UDF (User-Defined Function) library allow the entire decode to fit in a single FBD network. Upload a working UDF to the LOGO! and reference it from the main program.
Sample Ladder / FBD Program
The following minimal FBD snippet demonstrates the data flow inside LOGO!Soft Comfort.
Network 1 — Read Countis E24 HR 50514 (2 words) into VM
[Modbus Master DT Row #1]
IP=192.168.1.100, Port=502, Unit=1
Start Address=50514, Count=2
Dest=VM 0 (writes VW0 = high word, VW2 = low word)
Network 2 — Decode unsigned 32-bit
AI1 (VW0) -> MUL 65536 -> ADD -> VW10_hi
AI2 (VW2) -----------^
Result stored in VM words 10-11 as 32-bit unsigned
Network 3 — Scale to kWh × 100 (Countis E24 internal scaling)
VM10:11 -> DIV 100 -> AQ1 (display on LOGO! TDE)
For UDF users, the function block may be saved with the name UNPACK32_U_BE and dropped into any project requiring the same decode pattern.
Verification Procedure
- Power the Countis E24 and the LOGO!. Confirm link LEDs on both Ethernet ports.
- From the engineering PC, ping the Countis E24 at 192.168.1.100. A reply confirms L1/L2 physical and IP layer.
- Open Modbus Doctor (or equivalent) and read HR 50514 with Function 03, Count = 2, Unit ID = 1, IP 192.168.1.100, Port 502. Note the decimal value, e.g., 12345678.
- Compare against the Countis E24 front display reading (energy register in kWh × 100).
- Download the LOGO! program and force the DT row to read once via the LOGO! TDE menu (Tools → Ethernet → Read Once).
- Open LOGO!Soft Comfort online monitor and inspect VM words VW0, VW2, VW10, VW11. Confirm the unsigned 32-bit sum matches the Modbus Doctor reading.
- Run a step-load test: connect a known resistive load (e.g., 1 kW heater) for 5 minutes and verify the LOGO! display advances at the expected rate.
- Force a comm-loss fault by disconnecting the Ethernet cable. The LOGO! Modbus block should report Error Code 0x01 or NAK within the configured timeout. Restore the link and confirm auto-recovery.
Troubleshooting Matrix
| Symptom | Probable Cause | Diagnostic | Corrective Action |
|---|---|---|---|
| LOGO! shows 0 for all registers | Wrong Unit ID (still 255) | Modbus Doctor with Unit 255 vs Unit 1 | Reconfigure Countis E24 Unit ID = 1, power-cycle meter. |
| Modbus Exception Code 02 (Illegal Data Address) | Start address off-by-one | Modbus Doctor sweep from 50510 to 50518 | Increment DT Start Address by 1 (use 50515) and verify count alignment. |
| Value reads correctly in Doctor but negative in LOGO! | Unsigned high word interpreted as signed | Inspect VW0 raw value, check sign bit | Apply the full 32-bit unsigned decode (Network 2 above). |
| Value drifts after 32767 | 16-bit overflow assumption | Read VW0 with online monitor | Switch from single-word read (Count=1) to two-word read (Count=2). |
| No response from meter | Wrong port entered in DT (e.g., 505 instead of 502) | Wireshark capture on TCP port 502 | Edit DT row Port field to 502 and re-download program. |
| LOGO! shows -1 in analog input | Communication lost | LOGO! diagnostic buffer | Check cable, switch, meter power; verify IP reachability. |
| Byte order mismatch (energy × 256) | Little-endian assumption | Compare HR 50514 swap vs no-swap | Countis E24 is big-endian — do not swap words; verify with Modbus Doctor. |
| LOGO! BM does not have Modbus option | Wrong LOGO! variant | Check catalog number | Upgrade to LOGO! 8 with Ethernet (6ED1052-1MD08-0BA1 or similar). |
Advanced Configuration Notes
For multi-meter sites, the LOGO! supports multiple Modbus TCP connections, but each requires its own DT row. Reuse the same Destination Start Address block only if the source meters are read sequentially and the destination words do not overlap. The LOGO! BM Ethernet block processes DT rows in order, so high-priority registers should occupy the upper rows to minimize poll latency.
When interfacing with a higher-level SCADA through the LOGO! as a gateway, consider exposing the decoded 32-bit energy value as two Modbus registers from the LOGO! server side. The LOGO! server configuration maps VM words back into HRs on TCP/502 for SCADA polling. This avoids forcing the SCADA to decode Countis E24 raw scaling.
Safety and Compliance
The Countis E24 must be installed by qualified personnel following local low-voltage directives. Energy metering circuits may carry hazardous voltages even when the Countis E24 itself is de-energized at the communication terminals. Always isolate both line and load sides of the meter before any wiring change. The LOGO! Ethernet interface is SELV and may remain connected while the meter is powered.
For installations subject to IEC 61000-4-30 power quality measurement requirements, verify that the Countis E24 measurement mode (Class 1 or Class 0.5S depending on variant) meets the application specification. The LOGO! does not perform power-quality analysis — it only mirrors the Countis E24 registers.
FAQ
Why does my LOGO! show -1 even when the meter is responding in Modbus Doctor?
The LOGO! analog network input block returns -32768 (displayed as -1 scaled) when the source VM word is unread or the Modbus DT row has not completed a successful poll. Verify the DT row's Enable flag is set, the Source Port equals 502, and the Unit ID matches the Countis E24 configuration (typically 1, not 255).
What is the correct Modbus port and Unit ID for the SOCOMEC Countis E24?
The Countis E24 Modbus TCP server listens on TCP port 502 by default. The Unit Identifier (slave ID) ships as 255 from the factory; reassigning to 1 prevents sporadic exceptions and aligns with the LOGO! DT default Unit field of 1.
How do I read a 32-bit unsigned integer like the Countis E24 energy register?
Configure the LOGO! DT row with Count = 2 to read both words into VW0 (high) and VW2 (low). Then decode using arithmetic that treats the high word as an unsigned 16-bit value: multiply by 65536 (or add 65536 if signed-negative) and combine with the low word. See Method B in the article for the complete decode sequence.
Why does my LOGO! address 50514 return an Illegal Data Address exception?
Some LOGO! 8 firmware revisions apply an internal +1 offset to Modbus HR addresses. Set the DT Start Address to 50515 and verify with Modbus Doctor at the same address that the response is valid. The count and decode math must also shift to read starting at HR 50515 with Count = 2.
Does the LOGO! 8 support Modbus TCP master and slave simultaneously?
Yes. LOGO! 8 firmware 8.0 and later supports Modbus TCP as both client (master) for reading meters like the Countis E24, and server (slave) for SCADA polling. The two roles operate on the same TCP/502 port without conflict because the LOGO! separates the client DT (request) and server VM mapping (response) tables.