I’m trying to read some values from a modbus TCP device. Some of the values are described as 2 word Long Interger in manual. When I set up OPC Ithem Path for the register that hold these values I use prefix HRI, but do not get the correct value. But if I read these two registers separately with the prefix HR, I get two numbers that will represent the correct value if I put them together.
HRI129 -> 2163896
HR129 -> 33
HR130 -> 1208
The correct value is 331208.
I see how this arises with how the binary values are put together. But is there a way to get around this, or do I have to read all the register separately and then concat them together in a memory tag.
I believe you're going to have to put them together using an expression tag or a derived tag. The Modbus specification will always put them together using binary.
Agreed, what a strange device… You could create an expression tag (data type Integer) with stringFormat("%d%d", {[~]HR129}, {[~]HR130}) and achieve what you’re looking for. It will concatenate the values together and the cast back to Integer will handle converting it back to a number.