Debian Codegraph @

docs/modbus_read_input_bits.md

raw symbols SCIP
1 # modbus_read_input_bits
2
3 ## Name
4
5 modbus_read_input_bits - read many input bits
6
7 ## Synopsis
8
9 ```c
10 int modbus_read_input_bits(modbus_t *ctx, int addr, int nb, uint8_t *dest);
11 ```
12
13 ## Description
14
15 The *modbus_read_input_bits()* function shall read the content of the `nb` input
16 bits to the address `addr` of the remote device. The result of reading is stored
17 in `dest` array as unsigned bytes (8 bits) set to `TRUE` or `FALSE`.
18
19 The `dest` array must be allocated with at least `nb * sizeof(uint8_t)` bytes.
20 It is the caller's responsibility to ensure the buffer is large enough to hold
21 all the bits to be read.
22
23 The function uses the Modbus function code 0x02 (read input status).
24
25 ## Return value
26
27 The function shall return the number of read input status if
28 successful. Otherwise it shall return -1 and set errno.
29
30 ## Errors
31
32 - *EINVAL*, the `ctx` or `dest` argument is NULL, or `nb` is less than 1.
33 - *EMBXILVAL*, too many discrete inputs requested (nb > MODBUS_MAX_READ_BITS).
34
35 ## See also
36
37 - [modbus_read_input_registers](modbus_read_input_registers.md)