Commit 5f77c11403e585fb09b30c13264a82aa229bded0
1 parent
7fe4a917
Updated libmodbus.txt documentation
Showing
1 changed file
with
27 additions
and
4 deletions
doc/libmodbus.txt
| @@ -54,9 +54,13 @@ Modbus RTU message must be transmitted continuously without inter-character | @@ -54,9 +54,13 @@ Modbus RTU message must be transmitted continuously without inter-character | ||
| 54 | hesitations (extract from Wikipedia, Modbus, http://en.wikipedia.org/wiki/Modbus | 54 | hesitations (extract from Wikipedia, Modbus, http://en.wikipedia.org/wiki/Modbus |
| 55 | (as of Mar. 13, 2011, 20:51 GMT). | 55 | (as of Mar. 13, 2011, 20:51 GMT). |
| 56 | 56 | ||
| 57 | +The Modbus RTU framing calls a slave, a device/service which handle Modbus | ||
| 58 | +requests, and a master, a client which send requests. The communication is | ||
| 59 | +always initiated by the master. | ||
| 60 | + | ||
| 57 | Many Modbus devices can be connected together on the same physical link so you | 61 | Many Modbus devices can be connected together on the same physical link so you |
| 58 | need to define which slave is concerned by the message with | 62 | need to define which slave is concerned by the message with |
| 59 | -linkmb:modbus_set_slave[3]. If you're running a slave (server) the slave number | 63 | +linkmb:modbus_set_slave[3]. If you're running a slave, the slave number |
| 60 | is used to filter messages. | 64 | is used to filter messages. |
| 61 | 65 | ||
| 62 | Create a Modbus RTU context:: | 66 | Create a Modbus RTU context:: |
| @@ -124,10 +128,11 @@ Flush a connection:: | @@ -124,10 +128,11 @@ Flush a connection:: | ||
| 124 | linkmb:modbus_flush[3] | 128 | linkmb:modbus_flush[3] |
| 125 | 129 | ||
| 126 | 130 | ||
| 127 | -Data | ||
| 128 | -~~~~ | 131 | +Client |
| 132 | +~~~~~~ | ||
| 129 | The Modbus protocol defines different data types and functions to read and write | 133 | The Modbus protocol defines different data types and functions to read and write |
| 130 | -them from/to remote devices. | 134 | +them from/to remote devices. The following functions are used by the clients to send |
| 135 | +Modbus requests: | ||
| 131 | 136 | ||
| 132 | Read data:: | 137 | Read data:: |
| 133 | linkmb:modbus_read_bits[3] | 138 | linkmb:modbus_read_bits[3] |
| @@ -141,6 +146,24 @@ Write data:: | @@ -141,6 +146,24 @@ Write data:: | ||
| 141 | linkmb:modbus_write_bits[3] | 146 | linkmb:modbus_write_bits[3] |
| 142 | linkmb:modbus_write_registers[3] | 147 | linkmb:modbus_write_registers[3] |
| 143 | 148 | ||
| 149 | +Raw requests:: | ||
| 150 | + linkmb:modbus_send_raw_request[3] | ||
| 151 | + linkmb:modbus_receive_confirmation[3] | ||
| 152 | + | ||
| 153 | + | ||
| 154 | +Server | ||
| 155 | +~~~~~~ | ||
| 156 | +The server is waiting for request from clients and must answer when it is | ||
| 157 | +concerned by the request. The libmodbus offers the following functions to | ||
| 158 | +receive and reply: | ||
| 159 | + | ||
| 160 | +Receive:: | ||
| 161 | + linkmb:modbus_receive[3] | ||
| 162 | + linkmb:modbus_receive_from[3] | ||
| 163 | + | ||
| 164 | +Reply:: | ||
| 165 | + linkmb:modbus_reply[3] | ||
| 166 | + | ||
| 144 | 167 | ||
| 145 | ERROR HANDLING | 168 | ERROR HANDLING |
| 146 | -------------- | 169 | -------------- |