Commit 64e21cce55398b0366e9fd6b8b4335e2c94cf605
1 parent
a2e41db3
Added documentation of modbus_write_and_read_registers
Showing
4 changed files
with
56 additions
and
0 deletions
NEWS
| ... | ... | @@ -10,6 +10,7 @@ libmodbus 2.9.5 (2011-06-XX) |
| 10 | 10 | * modbus_read_and_write_registers -> modbus_write_and_read_registers |
| 11 | 11 | The function name was confusing because the write operation is performed |
| 12 | 12 | before the read. Take care to swap the arguments in the migration process. |
| 13 | +- Documentation of modbus_write_and_read_registers | |
| 13 | 14 | |
| 14 | 15 | libmodbus 2.9.4 (2011-06-05) |
| 15 | 16 | ============================ | ... | ... |
doc/Makefile.am
doc/libmodbus.txt
| ... | ... | @@ -154,6 +154,9 @@ Write data:: |
| 154 | 154 | linkmb:modbus_write_bits[3] |
| 155 | 155 | linkmb:modbus_write_registers[3] |
| 156 | 156 | |
| 157 | +Write and read data:: | |
| 158 | + linkmb:modbus_write_and_read_registers[3] | |
| 159 | + | |
| 157 | 160 | Raw requests:: |
| 158 | 161 | linkmb:modbus_send_raw_request[3] |
| 159 | 162 | linkmb:modbus_receive_confirmation[3] | ... | ... |
doc/modbus_write_and_read_registers.txt
0 → 100644
| 1 | +modbus_write_and_read_registers(3) | |
| 2 | +================================== | |
| 3 | + | |
| 4 | + | |
| 5 | +NAME | |
| 6 | +---- | |
| 7 | +modbus_write_and_read_registers - write and read many registers in a single transaction | |
| 8 | + | |
| 9 | + | |
| 10 | +SYNOPSIS | |
| 11 | +-------- | |
| 12 | +*int modbus_write_and_read_registers(modbus_t *'ctx', int 'write_addr', int 'write_nb', const uint16_t *'src', int 'read_addr', int 'read_nb', const uint16_t *'dest')* | |
| 13 | + | |
| 14 | + | |
| 15 | +DESCRIPTION | |
| 16 | +----------- | |
| 17 | +The _modbus_write_and_read_registers()_ function shall write the content of the | |
| 18 | +'write_nb' holding registers from the array 'src' to the address 'write_addr' of | |
| 19 | +the remote device then shall read the content of the 'read_nb' holding registers to | |
| 20 | +the address 'read_addr' of the remote device. The result of reading is stored in | |
| 21 | +'dest' array as word values (16 bits). | |
| 22 | + | |
| 23 | +You must take care to allocate enough memory to store the results in 'dest' | |
| 24 | +(at least 'nb' * sizeof(uint16_t)). | |
| 25 | + | |
| 26 | +The function uses the Modbus function code 0x17 (write/read registers). | |
| 27 | + | |
| 28 | + | |
| 29 | +RETURN VALUE | |
| 30 | +------------ | |
| 31 | +The _modbus_write_and_read_registers()_ function shall return the number of read | |
| 32 | +registers if successful. Otherwise it shall return -1 and set errno. | |
| 33 | + | |
| 34 | + | |
| 35 | +ERRORS | |
| 36 | +------ | |
| 37 | +EMBMDATA:: | |
| 38 | +Too many registers requested, Too many registers to write | |
| 39 | + | |
| 40 | + | |
| 41 | +SEE ALSO | |
| 42 | +-------- | |
| 43 | +linkmb:modbus_read_registers[3] | |
| 44 | +linkmb:modbus_write_register[3] | |
| 45 | +linkmb:modbus_write_registers[3] | |
| 46 | + | |
| 47 | + | |
| 48 | +AUTHORS | |
| 49 | +------- | |
| 50 | +The libmodbus documentation was written by Stéphane Raimbault | |
| 51 | +<stephane.raimbault@gmail.com> | ... | ... |