Debian Codegraph @

docs/modbus_write_registers.md

raw symbols SCIP
1 # modbus_write_registers
2
3 ## Name
4
5 modbus_write_registers - write many registers
6
7 ## Synopsis
8
9 ```c
10 int modbus_write_registers(modbus_t *ctx, int addr, int nb, const uint16_t *src);
11 ```
12
13 ## Description
14
15 The *modbus_write_registers()* function shall write the content of the `nb`
16 holding registers from the array `src` at address `addr` of the remote device.
17
18 The `src` array must be allocated with at least `nb` elements. It is the
19 caller's responsibility to ensure the buffer is large enough to hold all the
20 registers to be written.
21
22 The function uses the Modbus function code 0x10 (preset multiple registers).
23
24 ## Return value
25
26 The function shall return the number of written registers if
27 successful. Otherwise it shall return -1 and set errno.
28
29 ## Errors
30
31 - *EINVAL*, the `ctx` or `src` argument is NULL, or `nb` is less than 1.
32 - *EMBXILVAL*, writing too many registers (nb > MODBUS_MAX_WRITE_REGISTERS).
33
34 ## See also
35
36 - [modbus_write_register](modbus_write_register.md)
37 - [modbus_read_registers](modbus_read_registers.md)