HEX decimal data points to decimal

  1. In Modbus protocol, we need to read two HEX decimal data points and convert them to decimal.
    Which function code should be used for the conversion?

  2. We need to write a 32-bit (data type: REAL) register address from the PLC to the Third Party equipment. Which function code should be used?


I don’t think that you have to convert from hex to dec, because both values are only the same representation of a 32bit value in different number systems.
As Modbus defines it’s registers as 16bit values, higher values (for example 32bit integers and also 32bit reals) have to be “split” into two registers for transfer.
Please have a look here for a example about 32bit real (the way it could be done is also valid for 32bit integers):

Best regards!

1 Like