MODBUS_GET_FLOAT_CDA(3)

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

πŸ’– MODBUS_GET_FLOAT_CDA(3) πŸ’–

okay bestie, welcome to the libmodbus Manual β€” yes this is a real section 3 page and yes we're gonna make it cute. sit down, grab a strawberry πŸ“, we're decoding floats.


✨ NAME ✨

modbus_get_float_cdab β€” get a float value from 2 registers in CDAB byte order πŸ¦‹


🌸 SYNOPSIS 🌸

float modbus_get_float_cdab(const uint16_t *src);

πŸ’… DESCRIPTION πŸ’…

so modbus_get_float_cdab() shall get a float from 4 bytes with swapped words β€” that's CDAB order instead of the usual ABCD. it's giving "word order said sike". 😭

the src array must be a pointer on two 16 bits values. no cap, that's the requirement.

like, for example, if the first word is set to F147 and the second to 0x0020, the float value will be read as 123456.0. iconic behavior honestly ✨

fr fr though: src has to point at two 16-bit values. that's not a suggestion, that's the whole deal.

🫢 RETURN VALUE 🫢

the function shall return a float. that's it. that's the tea. β˜•


πŸ”₯ SEE ALSO πŸ”₯

the whole float squad, go say hi πŸ‘‘


πŸ‘‘ AUTHORS πŸ‘‘

the libmodbus documentation was written by StΓ©phane Raimbault <stephane.raimbault@gmail.com> β€” main character energy, we love to see it πŸ’œ


and that's the page bestie!! this was libmodbus v3.1.6, dated 11/17/2025 πŸŽ€ go read your floats, you absolute icon, periodt πŸ’…βœ¨

πŸ“¦ where this page comes from