Jump to content

Modbus - loss of floating point precision


EricLarsen

Recommended Posts

I'm trying to read some data from a Modbus instrument using the I/O server in DSC over TCP. The instrument writes a 32 bit floating point value into 2 16 bit registers. If I read the two 16 registers separately, then combine and typecast them I get the correct value. However, if I rely on the I/O server to read the floating point value directly, it gets a slightly incorrect result.

For example, my instrument wrote the value 34.80 into the two registers 30123 and 30124. If I read each register (300123,300124) separately and combine the values, I get the correct 34.80 result . However, if I read the register F300124 I get the result of 34.85. This is consistent; I always get a value that is about 0.05 to 0.10 off. At first I thought that was the incorrect floating point address, so I tried reading F300123, but that returns a result on the order of 6.7e-6.

I'm never tried to use DSC to interface to modbus, so I'm probably missing something obvious, but I'm stumped. Any ideas?

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.