MODBUS_SET_FLOAT_BAD(3)

πŸ“¦
version 3.1.6 Β· 3 versions
, in debian bookworm

πŸ’… 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 that dest needing room for two uint16_t values. 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