MODBUS_READ_INPUT_BI(3)
π 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 indestβ at leastnb * 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
- 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