MODBUS_READ_INPUT_RE(3)

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

πŸ’– 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 in dest. we're talking at least nb * 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