Reading registers - Socomec Diris


Thread Starter

Mark H

Hi there, could really use some help!

I am trying to read data from a Socomec Diris A40 using NModbus, an C# implementation of Modbus.

I have used sample code as a template, tweaked a little and have managed to read some values from the device. The problem is I dont know which values they are as the Diris documentation lists hundreds of addresses, but not all of them valid (at least in my case). I cannot access the registers I am looking for (Active/Reactive/Apparent power) because the addresses specified are incorrect(SlaveException). Are they in fact wrong, or am I coding/thinking incorrectly? How can I find the right ones? Should I be using the entire address number? 50536 for example.

I am definitely getting values from the device with guessed addresses, and they are in decimal. Is this normal? Other posts and documentation suggest I should be returned hex values? Does this matter?

Any help would be much appreciated!!

...the exception is the same as this one discussed here:

Lynn August Linse

> Should I be using the entire
> address number? 50536 for example.

A register documented as 50536 means you are reading 4x50536, which means poll either raw offset 50535 or 50536.

Be aware that many power meters that I've worked with use 32-bit values and they won't return misaligned data. So if the true offset to a 32-bit float is 50535, then reading 1 or 3 registers returns an exception - you'll have to read 2, 4 etc. Also trying to read 2 registers at 50536 would fail if that means you'd have 1/2 of one float and 1/2 of another.

This is NOT a Modbus issue - just an implementation issue. The implementor is trying to protect you from your own inexperience, which adds to your frustration & learning curve.
Makes sense. However I have tried all the variations for offset and register reads and yet nothing will work :/ I take it by reading in two registers you mean the typical Modbus parameter specifing the number of registers to read? I use the following code to integrate the two registers:<pre>
for (int i = 0; i < numRegisters; i += 2)
ushort[] val = new ushort[] { registers, registers[i + 1] };
byte[] B1 = BitConverter.GetBytes(val[0]);
byte[] B2 = BitConverter.GetBytes(val[1]);
byte[] B3 = new byte[4]; // 32 bits
Array.Copy(B1, 0, B3, 0, 2);
Array.Copy(B2, 0, B3, 2, 2);
int final = BitConverter.ToInt32(B3, 0);

I have errors for accesses using my code, MODPOLL and Modbus Tester. I emailed socomec, and the response so far has been as follows...


"The thing is that our meter is using a NON STANDARD address mapping in this meter.

Typically the address range for the data types are Modbus 41001 to 41099 - but our meter addresses have been mapped to up in the 9xxxx range (4+5).

One of our customers is working with the Kepware OPC/Modbus driver for his SCADA system interface.

They had succeed to read and write 9xxxx addresses

My self, I use modbus tester through IP for some tests, and it works as well"


Here he explains that they use 9xxxx addresses, which I thought meant 4xxxx + 50544 etc, entering this value into Modbus Tester (which is displays as a 9xxxx) also yeilds and error :( He never explained what start address exactly he entered, which is exactly what im looking for.

I appreciate your help thus far, and I realise its getting very specific now, sorry. If you have any further insights, they are most welcome though.
Hi, i had the same problems to read register from diris.
After some mails with Socomec I got it to run.
For testing i used CAS Modbbus Scanner from Chipkin<pre>
Diris use 03-HoldingRegister (4xxxx):
Poll (in Modbus-scanner):
0x05 0x03 0xC552 0x02
Slave 5: Function3 Adr 50514 Length
0x05 0x03 0x00 0x00 0x9F5F
Slave 5: Function3 Value

so the address is generated like: (Function3=4xxxx)
40000 + 50514 = 90514
but ModBus is a little bit different to JBus:
In my case i had to add 1 to the offset, like:
Address 50514 + 1 = 50515 + 40000 => 905515</pre>
so it worked for me.
I have a same problem
I try to read expl register 50516 but cant
With modescan32 also tothing.
How can i read the socomec counter registers with normal modbus rtu devices? Exlp loxone