MODBUS_READ_INPUT_RE(3)
π MODBUS_READ_INPUT_RE(3) π
okay bestie, pull up a chair, we're reading the libmodbus manual together and honestly? this one's a bop. it's page 3 of the libmodbus Manual and it's about grabbing a whole pile of input registers at once. no cap. β¨
πΈ NAME πΈ
modbus_read_input_registers β read many input registers π«Ά
β¨ SYNOPSIS β¨
int modbus_read_input_registers(modbus_t *ctx, int addr, int nb,
uint16_t *dest);
π¦ DESCRIPTION π¦
so like, modbus_read_input_registers() shall read the content of the nb input registers at address addr of the remote device. that's the whole vibe. the reading result gets stored in the dest array as word values (16 bits). π
β οΈ not me forgetting to allocate memory β you MUST take care to allocate enough memory to store the results indest. we're talking at leastnb * sizeof(uint16_t). do the math before you do the crime, bestie, or it's giving undefined behavior π
the function uses the Modbus function code 0x04 (read input registers), which is lowkey iconic. also fun lore drop: the holding registers and input registers have different historical meaning, but nowadays it's more common to use holding registers only. iykyk π§
π₯ RETURN VALUE π₯
if it slays, the function shall return the number of read input registers. π
if it does NOT slay, it shall return -1 and set errno. periodt. π
π ERRORS π
EMBMDATAβ Too many bits requested π
π SEE ALSO π
π AUTHORS π
The libmodbus documentation was written by StΓ©phane Raimbault <stephane.raimbault@gmail.com> β absolute legend, we stan π«Ά
and that's the whole page, bestie!! this manual page came to you courtesy of libmodbus v3.1.6, dated 11/17/2025. go forth and read those input registers, you gorgeous main character πβ¨π
π¦ 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