Hello,
I started to use siemens sentron pac3200 energy analyser with this library.
For the address 801 a double value returns like below:
<29><E8><00><00><00><0B><FF><03><08><41><E5><61><A9><ED><DE><6E><39>
And this the value part 8 bytes - 4 words: <41><E5><61><A9><ED><DE><6E><39>
I need a similar conversion function like for the float values but for double values
float modbus_get_float_dcba(const uint16_t *src)
double modbus_get_double_dcba(const uint16_t *src)
Can anyone convert this function to double?
/* Get a float from 4 bytes (Modbus) in inversed format (DCBA) */
float modbus_get_float_dcba(const uint16_t *src)
{
float f;
uint32_t i;
i = ntohl(bswap_32((((uint32_t)src[0]) << 16) + src[1]));
memcpy(&f, &i, sizeof(float));
return f;
}
Regards,
Ali