MODBUS_GET_FLOAT_BAD(3)
π MODBUS_GET_FLOAT_BAD(3) π
okay bestie, so this one is a page from the libmodbus Manual, section 3, and it's about a little function called modbus_get_float_badc. she's niche, she's specific, and she's here to decode your byte-swapped float drama. let's get into it β¨
πΈ NAME πΈ
modbus_get_float_badc β get a float value from 2 registers in BADC byte order π¦
β¨ SYNOPSIS β¨
float modbus_get_float_badc(const uint16_t *src);
π DESCRIPTION π
okay so the way that modbus_get_float_badc() works is: it shall get a float from 4 bytes, but with the bytes swapped β it's giving BADC instead of ABCD. not the usual order, not the mainstream order, and honestly? iconic for that π
the src array must be a pointer on two 16-bit values. no cap, it has to be two of them. so like, for example, if the first word is set to 0x2000 and the second to 0x47F1, then the float value will be read as 123456.0. slay. that's it, that's the whole trick π
π«Ά RETURN VALUE π«Ά
the function shall return a float. that's her whole job, and she does it well π
π₯ SEE ALSO π₯
go read the whole float family bestie, they're all sisters π
π AUTHORS π
the libmodbus documentation was written by StΓ©phane Raimbault <stephane.raimbault@gmail.com>. thank you legend, we owe you our lives fr fr π
and that's a wrap, bestie!! this whole page came to you from libmodbus v3.1.6, dated 11/17/2025. byte-swapped floats could never confuse us now πβ¨π¦
π¦ 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