11-23-2022 09:01 AM - edited 11-23-2022 09:02 AM
@Wavicle wrote:
Ok, I got it.
I don't know why, but I have to put the register address minus 1, if I do that I get the values perfectly using what you posted.
Many many thanks K C
Check your code. We can't see what the floating point type is that you are typecasting to, but the indicator is definitely a double, which leads me to believe that you are typecasting to a double, especially since the indicator label is *(type)* &x. Typecasting does unexpected things if you don't have the correct amount of bytes to make the conversion directly - e.g., only one byte for a 16 bit integer, etc. (Read the detailed help.) This could be the reason offsetting by -1 works. You are actually reading from the register before, but the register is probably all zeroes, shifting the bytes to be read from the MSB to the LSB, giving you the correct answer. I'm not saying it's true, but it's likely enough that you should make sure that it is not.
Edit: I did not see KC's reply. That is most likely the solution. (Why would they do this? Ugh.)
11-24-2022 02:13 AM
Hi Bill,
The +1 in the DCS address is the source of many discussions I had.
It is even worse. If the DCS address is 40185. It is ModBus function 3 and address 184.
If a DCS engineer knows nothing about the physical layer and the protocol you can imagine how difficult it to talk with them.
Kees
11-24-2022 03:54 AM
@K C wrote:
Hi Bill,
The +1 in the DCS address is the source of many discussions I had.
It is even worse. If the DCS address is 40185. It is ModBus function 3 and address 184.
If a DCS engineer knows nothing about the physical layer and the protocol you can imagine how difficult it to talk with them.
Kees
"Yikes" is all I can say to that.