MODBUS_SET_FLOAT_BAD(3)
π MODBUS_SET_FLOAT_BAD(3) π
okay bestie, welcome to the libmodbus manual, and today's main character is modbus_set_float_badc β she's a lil function, she's got one job, and she does it in byte order that will absolutely humble you if you're not paying attention π«Ά
β¨ NAME β¨
modbus_set_float_badc β sets a float value into 2 registers using BADC byte order π
πΈ SYNOPSIS πΈ
void modbus_set_float_badc(float f, uint16_t *dest);
that's it. that's the whole vibe. one line, zero drama (until you get the byte order wrong, then it's all drama π).
π¦ DESCRIPTION π¦
so here's the tea, bestie: modbus_set_float_badc() shall set a float to 4 bytes in swapped bytes Modbus format β that's BADC instead of ABCD, iykyk π₯
and listen, the dest array has to be a pointer on two 16 bit values, because that is literally the only way it can hold the full result of the conversion. two registers. no more, no less. she needs her space, okay? π
π RETURN VALUE π
there are no return values. nothing. void. she gives you nothing back and honestly? iconic behaviour, we respect it π
π SEE ALSO π
your little squad of related functions, go read them too:
byte order girlies stay winning π
π AUTHORS π
the libmodbus documentation was written by StΓ©phane Raimbault <stephane.raimbault@gmail.com> β thank you for the lore, king π«Ά
fr fr, don't sleep on thatdestneeding room for twouint16_tvalues. that's the whole plot twist of this page β¨
and that's the whole page bestie!! this was libmodbus v3.1.6, dated 11/17/2025, and she ate, no cap ππΈβ¨ππ¦
π¦ 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