MODBUS_GET_FLOAT_DCB(3)

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

πŸ’– MODBUS_GET_FLOAT_DCB(3) πŸ’–

okay bestie, welcome to the libmodbus Manual ✨ pull up a chair, we're decoding floats today πŸ¦‹


🌸 NAME 🌸

modbus_get_float_dcba β€” get a float value from 2 registers in DCBA byte order πŸ’…


✨ SYNOPSIS ✨

float modbus_get_float_dcba(const uint16_t *src);

πŸŽ€ DESCRIPTION πŸŽ€

so like, modbus_get_float_dcba() shall grab a float out of 4 bytes that are sitting in inversed Modbus format β€” that's DCBA order instead of the usual ABCD, she's doing it backwards and she's doing it correctly πŸ‘‘

your src array must be a pointer to two 16-bit values, no cap. for example, if the first word is set to 0x47F1 and the second one to 0x2000, then the float value gets read as 123456.0. literally that simple 🧚

ngl bestie, src has to be a real pointer to two uint16_t values β€” don't be out here handing it something else πŸ™ˆ

πŸ”₯ RETURN VALUE πŸ”₯

the function shall return a float. that's it, that's the whole vibe ⭐


🌈 SEE ALSO 🌈

go read the whole float squad, iykyk πŸ’œ


πŸ‘‘ AUTHORS πŸ‘‘

the libmodbus documentation was written by StΓ©phane Raimbault <stephane.raimbault@gmail.com> β€” absolute icon, we stan 🫢


and that's the page fr fr πŸ’– this was libmodbus v3.1.6, dated 11/17/2025 β€” slay, periodt, go read a float 🌸✨

πŸ“¦ where this page comes from