Problem Reading Modbus TCP-Register

Hi!

I’m having a strange problem with Modbus TCP.
I have connected our Ignition server to a Saia PCD through Modbus TCP.
I’m reading energy consumption information from the PCD.
It worked correctly up till last Saturday. Around six a clock when the register reached value of 65436 (raw value) it suddenly set the value to 0.
Now its counting upwards correctly. (When i add the 65436 to the current value i get the correct value)

When i connect to the PCD straight and look at the register, it is showing the correct value.
Also when i added a new SQL-Tag that was connected to the same register, it still shows the incorrect value (Value that was zeroed on Saturday).

What could be causing this?

Maybe you’re supposed to be reading 2 registers as a 32-bit value instead of 1 as a 16-bit value… does this sound possible? Do you have documentation for the unit?

Hi!

I was thinking that too, but when i read the registers as 32-bit its shows a value 2 314 456 413, or something on that line.
I also tried the Step-Function and it didn’t help.
The PCD is connected to a Energy meter through Modbus RTU and is reading a 32-bit register.

Do you mean the PCDs documentation?
Here is a link to a manual:
saia-support.com/en/product- … -pcd1room/

Have you tired setting the reverse word order property to true in the device settings for this device?Sounds like you might be reading the value backward since you are getting such a large number when trying to read a 32 bit register.

Hi!

Yes that solved the problem with the big number.
But it didn’t solve the initial problem. We are reading the value as a 32bit, but after it reaches 65535 it resets to 0. :scratch:

PS. Sorry about the slow answer. :blush:

whats the datatype of your sqltag?

Its Float 8

Can I see the OPC Item path for the tag in question ?

OPC Item Path: [DEVICE_NAME]1.HRI340

Have you tried reading the second bit first like [DEVICE_NAME]1.HRI341 ? It could be that you are reading the registers in the wrong order. And you need to start from the second register first.

Okay.
How do i combine the registers if i read them in “wrong order”?
Meaning that i read the the second address first and then the first. How do i make them a one 32-bit register?

Using the HRI prefix is what is telling the modbus device to read the two 16-bit registers as a single 32-bit register. So if you were trying to read [deviceName]1.HRI340 you will need to change this to [deviceName]1.HRI341 so that you are reading 340 and 341 as a group that are treated as a single 32-bit register.

Hi!

Okay I tried that.
First when i put the second address first it gives me a value of 32 794 214,4.
So that means the registers are in wrong order.

I Took the Reverse Word-order off. Now it shows 4995 which is not correct either. (Also all the other values show up incorrectly)

We have made a script that gets around this problem:
We are counting the value from 0 to 65535 (which is being counted correctly) Then we count the times which the register has been set to 0 and we multiply the 65535 by that number and add that to the current counted value of the register. This shows the correct value.

I also have another problem with Modbus RTU / over TCP Should i add that one here or make new thred for it here?

Post it on a new thread if it is for a different problem.