MODBUS_GET_FLOAT(3)
π MODBUS_GET_FLOAT(3) π
okay bestie, welcome to the libmodbus corner of the manual, we're doing modbus_get_float today and it's giving legacy β¨
π NAME π
modbus_get_float β get a float value from 2 registers π«Ά
πΈ SYNOPSIS πΈ
float modbus_get_float(const uint16_t *src);
β οΈ Warning, and I need you to hear me on this one: this function is deprecated since libmodbus v3.2.0 and has been replaced by modbus_get_float_dcba(). Not me being dramatic, that's literally what it says. π
β¨ DESCRIPTION β¨
So modbus_get_float() shall get a float from 4 bytes in Modbus format (that's DCBA byte order, iykyk).
The src array must be a pointer on two 16 bits values, okay? Two. Not one, not three. Two. π
For example, if the first word is set to 0x4465 and the second to 0x229a, the float value will be 916.540649. No cap, that's the vibe. π¦
π RETURN VALUE π
The function shall return a float. That's it. That's the whole section. Slay. π
π SEE ALSO π
π AUTHORS π
The libmodbus documentation was written by StΓ©phane Raimbault <stephane.raimbault@gmail.com> β thank you legend, we are obsessed π«Άβ¨
libmodbus v3.1.6 πΈ 11/17/2025 π β mwah, that's the whole page, go read the non-deprecated one bestie, ily ππ¦β¨
π¦ where this page comes from
- debian bookworm: libmodbus-dev 3.1.6-2.1+deb12u1 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms