0

Allow data types such as float, string , double , long and short in the library called Nmodbus4. But I don't know how to implement for string and float , But integer and Boolean implementation was already done. Please any one can help me to find the solution for this.

  • Float & strings are essentially extensions to Modbus protocol. As Richard says, float is often implemented as scaled integers but many manufacturers implement both single & double precision floating point as described in IEEE 754. As IEEE754 says nothing about word & byte order - this is manufacturer specific - so you will need to check their documentation. When strings are supported this is often as multiple adjacent double characters (ie 2 8bit characters packed in a 16bit word) - similarly this can be manufacturer specific - so you will need to check their documentation. – PaulF Apr 24 '17 at 11:25
  • Exactly , I have to look at the Modbus documentation. That will be the solutions for this. Thank you PaulF. – MANIKANDAN Apr 24 '17 at 12:49

1 Answers1

0

Modbus only supports uint and bool data types - this isn't a limitation of the nmodbus4 library. The standard says nothing about storing floating point or string types.

Most device implementations use floating point by dividing by 10/100/1000 etc, but it's up to you as a user of the library to handle that. You'll need to look through the register table for your device to find how it stores each value.

Richard
  • 29,854
  • 11
  • 77
  • 120
  • Yes Its up to me to allow remaining datatypes in Modbus TCP IP Ethernet, We can not have any library for this other data types , I have to find out the way to support these other data types. Thanks Richard. – MANIKANDAN Apr 24 '17 at 12:55