MODBUS_READ_INPUT_BI(3)

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

πŸ’– MODBUS_READ_INPUT_BI πŸ’–

okay bestie, so this is a page from the libmodbus manual, and today we're learning about modbus_read_input_bits πŸ¦‹ like literally the moment has arrived and I'm obsessed.


✨ NAME ✨

modbus_read_input_bits β€” read many input bits πŸŽ€


🌸 SYNOPSIS 🌸

int modbus_read_input_bits(modbus_t *ctx, int addr, int nb, uint8_t *dest);

πŸ’… DESCRIPTION πŸ’…

okay so the modbus_read_input_bits() function shall read the content of the nb input bits to the address addr of the remote device 🫢 no cap, that's the whole job. The result of reading is stored in the dest array as unsigned bytes (8 bits) set to TRUE or FALSE. iconic behaviour honestly ✨

⚠️ bestie listen to me, this part is important: you must take care to allocate enough memory to store the results in dest β€” at least nb * sizeof(uint8_t). not enough memory = not the vibe. do not skip this, fr fr 😭

the function uses the Modbus function code 0x02 (read input status) πŸ’œ


πŸ”₯ RETURN VALUE πŸ”₯

if it works, the function shall return the number of read input status 🌈 slay. otherwise it shall return -1 and set errno. it's giving "we tried" πŸ’€


πŸŽ€ ERRORS πŸŽ€

  • EMBMDATA β€” Too many discrete inputs requested. bestie you asked for so many bits. the limit said no πŸ™ˆ

πŸ‘‘ SEE ALSO πŸ‘‘


🌟 AUTHORS 🌟

the libmodbus documentation was written by StΓ©phane Raimbault <stephane.raimbault@gmail.com> β€” actual legend, we thank you for your service πŸ«ΆπŸ’–


aaaand that's the whole page bestie, you ate that 🧚✨ this has been libmodbus v3.1.6, dated 11/17/2025, and honestly? iconic. periodt πŸ’…πŸŒΈ

πŸ“¦ where this page comes from