Commit 3a7923df9092530de3c060dbea5bf5535c791cf9

Authored by Michael Heimpold
Committed by Stéphane Raimbault
1 parent 2cbafa31

docs: small re-wordings, fix various small typos and style issues

Signed-off-by: Michael Heimpold <mhei@heimpold.de>
docs/index.md
@@ -77,7 +77,7 @@ Modbus specification, instead all bytes are sent as fast as possible and a @@ -77,7 +77,7 @@ Modbus specification, instead all bytes are sent as fast as possible and a
77 response or an indication is considered complete when all expected characters 77 response or an indication is considered complete when all expected characters
78 have been received. This implementation offers very fast communication but you 78 have been received. This implementation offers very fast communication but you
79 must take care to set a response timeout of slaves less than response timeout of 79 must take care to set a response timeout of slaves less than response timeout of
80 -master (ortherwise other slaves may ignore master requests when one of the slave 80 +master (otherwise other slaves may ignore master requests when one of the slaves
81 is not responding). 81 is not responding).
82 82
83 To create a Modbus RTU context, you should use [modbus_new_rtu](modbus_new_rtu.md). 83 To create a Modbus RTU context, you should use [modbus_new_rtu](modbus_new_rtu.md).
@@ -107,7 +107,7 @@ communications over TCP IPv4 and IPv6 networks. It does not require a checksum @@ -107,7 +107,7 @@ communications over TCP IPv4 and IPv6 networks. It does not require a checksum
107 calculation as lower layer takes care of the same. 107 calculation as lower layer takes care of the same.
108 108
109 Contrary to the TCP IPv4 only backend, the TCP PI backend offers hostname 109 Contrary to the TCP IPv4 only backend, the TCP PI backend offers hostname
110 -resolution but it consumes about 1Kb of additional memory. 110 +resolution but it consumes about 1 kB of additional memory.
111 111
112 Create a Modbus TCP PI context, you should use [modbus_new_tcp_pi](modbus_new_tcp_pi.md). 112 Create a Modbus TCP PI context, you should use [modbus_new_tcp_pi](modbus_new_tcp_pi.md).
113 113
docs/modbus_free.md
@@ -12,7 +12,7 @@ void modbus_free(modbus_t *ctx); @@ -12,7 +12,7 @@ void modbus_free(modbus_t *ctx);
12 12
13 ## Description 13 ## Description
14 14
15 -The *modbus_free()* function shall free an allocated modbus_t structure. 15 +The *modbus_free()* function shall free an allocated *modbus_t* structure.
16 16
17 ## Return value 17 ## Return value
18 18
docs/modbus_get_byte_from_bits.md
@@ -14,7 +14,7 @@ uint8_t modbus_get_byte_from_bits(const uint8_t *src, int index, unsigned int nb @@ -14,7 +14,7 @@ uint8_t modbus_get_byte_from_bits(const uint8_t *src, int index, unsigned int nb
14 14
15 The *modbus_get_byte_from_bits()* function shall extract a value from many 15 The *modbus_get_byte_from_bits()* function shall extract a value from many
16 bits. All `nb_bits` bits from `src` at position `index` will be read as a 16 bits. All `nb_bits` bits from `src` at position `index` will be read as a
17 -single value. To obtain a full byte, set nb_bits to 8. 17 +single value. To obtain a full byte, set `nb_bits` to 8.
18 18
19 ## Return value 19 ## Return value
20 20
docs/modbus_get_header_length.md
@@ -14,7 +14,7 @@ int modbus_get_header_length(modbus_t *ctx); @@ -14,7 +14,7 @@ int modbus_get_header_length(modbus_t *ctx);
14 14
15 The *modbus_get_header_length()* function shall retrieve the current header 15 The *modbus_get_header_length()* function shall retrieve the current header
16 length from the backend. This function is convenient to manipulate a message and 16 length from the backend. This function is convenient to manipulate a message and
17 -so its limited to low-level operations. 17 +so it's limited to low-level operations.
18 18
19 ## Return value 19 ## Return value
20 20
docs/modbus_mapping_free.md
@@ -12,8 +12,8 @@ void modbus_mapping_free(modbus_mapping_t *mb_mapping); @@ -12,8 +12,8 @@ void modbus_mapping_free(modbus_mapping_t *mb_mapping);
12 12
13 ## Description 13 ## Description
14 14
15 -The function shall free the four arrays of mb_mapping_t structure and finally  
16 -the mb_mapping_t referenced by `mb_mapping`. 15 +The function shall free the four arrays of *modbus_mapping_t* structure and finally
  16 +the *modbus_mapping_t* itself referenced by `mb_mapping`.
17 17
18 ## Return value 18 ## Return value
19 19
docs/modbus_mapping_new.md
@@ -14,7 +14,7 @@ modbus_mapping_t* modbus_mapping_new(int nb_bits, int nb_input_bits, int nb_regi @@ -14,7 +14,7 @@ modbus_mapping_t* modbus_mapping_new(int nb_bits, int nb_input_bits, int nb_regi
14 14
15 The *modbus_mapping_new()* function shall allocate four arrays to store bits, 15 The *modbus_mapping_new()* function shall allocate four arrays to store bits,
16 input bits, registers and inputs registers. The pointers are stored in 16 input bits, registers and inputs registers. The pointers are stored in
17 -modbus_mapping_t structure. All values of the arrays are initialized to zero. 17 +*modbus_mapping_t* structure. All values of the arrays are initialized to zero.
18 18
19 This function is equivalent to a call of the 19 This function is equivalent to a call of the
20 [modbus_mapping_new_start_address](modbus_mapping_new_start_address.md) function 20 [modbus_mapping_new_start_address](modbus_mapping_new_start_address.md) function
docs/modbus_mapping_new_start_address.md
@@ -18,12 +18,12 @@ modbus_mapping_t* modbus_mapping_new_start_address( @@ -18,12 +18,12 @@ modbus_mapping_t* modbus_mapping_new_start_address(
18 18
19 The `modbus_mapping_new_start_address()` function shall allocate four arrays to 19 The `modbus_mapping_new_start_address()` function shall allocate four arrays to
20 store bits, input bits, registers and inputs registers. The pointers are stored 20 store bits, input bits, registers and inputs registers. The pointers are stored
21 -in modbus_mapping_t structure. All values of the arrays are initialized to zero. 21 +in *modbus_mapping_t* structure. All values of the arrays are initialized to zero.
22 22
23 The different starting addresses make it possible to place the mapping at any 23 The different starting addresses make it possible to place the mapping at any
24 -address in each address space. This way, you can give access to the clients at 24 +address in each address space. This way, you can give access to clients to
25 values stored at high addresses without allocating memory from the address zero, 25 values stored at high addresses without allocating memory from the address zero,
26 -for eg. to make available registers from 340 to 349, you can use: 26 +for example to make available registers from 340 to 349, you can use:
27 27
28 ```c 28 ```c
29 mb_mapping = modbus_mapping_new_start_address(0, 0, 0, 0, 340, 10, 0, 0); 29 mb_mapping = modbus_mapping_new_start_address(0, 0, 0, 0, 340, 10, 0, 0);
docs/modbus_new_tcp.md
@@ -12,7 +12,7 @@ modbus_t *modbus_new_tcp(const char *ip, int port); @@ -12,7 +12,7 @@ modbus_t *modbus_new_tcp(const char *ip, int port);
12 12
13 ## Description 13 ## Description
14 14
15 -The *modbus_new_tcp()* function shall allocate and initialize a modbus_t 15 +The *modbus_new_tcp()* function shall allocate and initialize a *modbus_t*
16 structure to communicate with a Modbus TCP IPv4 server. 16 structure to communicate with a Modbus TCP IPv4 server.
17 17
18 The `ip` argument specifies the IP address of the server to which the client 18 The `ip` argument specifies the IP address of the server to which the client
@@ -20,8 +20,8 @@ wants to establish a connection. A NULL value can be used to listen any addresse @@ -20,8 +20,8 @@ wants to establish a connection. A NULL value can be used to listen any addresse
20 server mode. 20 server mode.
21 21
22 The `port` argument is the TCP port to use. Set the port to 22 The `port` argument is the TCP port to use. Set the port to
23 -`MODBUS_TCP_DEFAULT_PORT` to use the default one (502). It’s convenient to use a  
24 -port number greater than or equal to 1024 because it’s not necessary to have 23 +`MODBUS_TCP_DEFAULT_PORT` to use the default one (502). It's convenient to use a
  24 +port number greater than or equal to 1024 because it's not necessary to have
25 administrator privileges. 25 administrator privileges.
26 26
27 ## Return value 27 ## Return value
docs/modbus_new_tcp_pi.md
@@ -12,7 +12,7 @@ modbus_new_tcp_pi - create a libmodbus context for TCP Protocol Independent @@ -12,7 +12,7 @@ modbus_new_tcp_pi - create a libmodbus context for TCP Protocol Independent
12 12
13 ## Description 13 ## Description
14 14
15 -The *modbus_new_tcp_pi()* function shall allocate and initialize a modbus_t 15 +The *modbus_new_tcp_pi()* function shall allocate and initialize a *modbus_t*
16 structure to communicate with a Modbus TCP IPv4 or IPv6 server. 16 structure to communicate with a Modbus TCP IPv4 or IPv6 server.
17 17
18 The `node` argument specifies the host name or IP address of the host to connect 18 The `node` argument specifies the host name or IP address of the host to connect
@@ -21,8 +21,8 @@ listen any addresses in server mode. @@ -21,8 +21,8 @@ listen any addresses in server mode.
21 21
22 The `service` argument is the service name/port number to connect to. To use the 22 The `service` argument is the service name/port number to connect to. To use the
23 default Modbus port, you can provide an NULL value or the string "502". On many 23 default Modbus port, you can provide an NULL value or the string "502". On many
24 -Unix systems, it’s convenient to use a port number greater than or equal to 1024  
25 -because it’s not necessary to have administrator privileges. 24 +Unix systems, it's convenient to use a port number greater than or equal to 1024
  25 +because it's not necessary to have administrator privileges.
26 26
27 :octicons-tag-24: v3.1.8 handles NULL value for `service` (no *EINVAL* error). 27 :octicons-tag-24: v3.1.8 handles NULL value for `service` (no *EINVAL* error).
28 28
docs/modbus_read_input_bits.md
@@ -13,7 +13,7 @@ int modbus_read_input_bits(modbus_t *ctx, int addr, int nb, uint8_t *dest); @@ -13,7 +13,7 @@ int modbus_read_input_bits(modbus_t *ctx, int addr, int nb, uint8_t *dest);
13 ## Description 13 ## Description
14 14
15 The *modbus_read_input_bits()* function shall read the content of the `nb` input 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 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`. 17 in `dest` array as unsigned bytes (8 bits) set to `TRUE` or `FALSE`.
18 18
19 You must take care to allocate enough memory to store the results in `dest` 19 You must take care to allocate enough memory to store the results in `dest`
docs/modbus_receive.md
@@ -13,7 +13,7 @@ int modbus_receive(modbus_t *&#39;ctx&#39;, uint8_t *&#39;req&#39;); @@ -13,7 +13,7 @@ int modbus_receive(modbus_t *&#39;ctx&#39;, uint8_t *&#39;req&#39;);
13 ## Description 13 ## Description
14 14
15 The *modbus_receive()* function shall receive an indication request from the 15 The *modbus_receive()* function shall receive an indication request from the
16 -socket of the context `ctx`. This function is used by Modbus slave/server to 16 +socket of the context `ctx`. This function is used by a Modbus slave/server to
17 receive and analyze indication request sent by the masters/clients. 17 receive and analyze indication request sent by the masters/clients.
18 18
19 If you need to use another socket or file descriptor than the one defined in the 19 If you need to use another socket or file descriptor than the one defined in the
docs/modbus_reply.md
@@ -21,7 +21,7 @@ modbus mapping `mb_mapping` according to the type of the manipulated data. @@ -21,7 +21,7 @@ modbus mapping `mb_mapping` according to the type of the manipulated data.
21 21
22 If an error occurs, an exception response will be sent. 22 If an error occurs, an exception response will be sent.
23 23
24 -This function is designed for Modbus server. 24 +This function is designed for Modbus servers.
25 25
26 ## Return value 26 ## Return value
27 27
docs/modbus_rtu_get_rts.md
@@ -23,8 +23,8 @@ This function can only be used with a context using a RTU backend. @@ -23,8 +23,8 @@ This function can only be used with a context using a RTU backend.
23 23
24 ## Return value 24 ## Return value
25 25
26 -The function shall return the current RTS mode if successful. Otherwise it shall  
27 -return -1 and set errno. 26 +The function shall return the current RTS mode if successful. Otherwise it
  27 +shall return -1 and set errno to one of the values defined below.
28 28
29 ## Errors 29 ## Errors
30 30
docs/modbus_rtu_get_rts_delay.md
@@ -19,8 +19,8 @@ This function can only be used with a context using a RTU backend. @@ -19,8 +19,8 @@ This function can only be used with a context using a RTU backend.
19 19
20 ## Return value 20 ## Return value
21 21
22 -The `modbus_rtu_get_rts_delay()` function shall return the current RTS delay in  
23 -microseconds if successful. Otherwise it shall return -1 and set errno. 22 +The function shall return the current RTS delay in microseconds if successful.
  23 +Otherwise it shall return -1 and set errno to one of the values defined below.
24 24
25 ## Errors 25 ## Errors
26 26
docs/modbus_rtu_get_serial_mode.md
@@ -15,13 +15,13 @@ int modbus_rtu_get_serial_mode(modbus_t *ctx); @@ -15,13 +15,13 @@ int modbus_rtu_get_serial_mode(modbus_t *ctx);
15 The *modbus_rtu_get_serial_mode()* function shall return the serial mode 15 The *modbus_rtu_get_serial_mode()* function shall return the serial mode
16 currently used by the libmodbus context: 16 currently used by the libmodbus context:
17 17
18 -- **MODBUS_RTU_RS232**, the serial line is set for RS232 communication. RS-232 18 +- **MODBUS_RTU_RS232**, the serial line is set for RS-232 communication. RS-232
19 (Recommended Standard 232) is the traditional name for a series of standards 19 (Recommended Standard 232) is the traditional name for a series of standards
20 for serial binary single-ended data and control signals connecting between a 20 for serial binary single-ended data and control signals connecting between a
21 DTE (Data Terminal Equipment) and a DCE (Data Circuit-terminating Equipment). 21 DTE (Data Terminal Equipment) and a DCE (Data Circuit-terminating Equipment).
22 It is commonly used in computer serial ports 22 It is commonly used in computer serial ports
23 23
24 -- **MODBUS_RTU_RS485**, the serial line is set for RS485 communication. EIA-485, 24 +- **MODBUS_RTU_RS485**, the serial line is set for RS-485 communication. EIA-485,
25 also known as TIA/EIA-485 or RS-485, is a standard defining the electrical 25 also known as TIA/EIA-485 or RS-485, is a standard defining the electrical
26 characteristics of drivers and receivers for use in balanced digital 26 characteristics of drivers and receivers for use in balanced digital
27 multipoint systems. This standard is widely used for communications in 27 multipoint systems. This standard is widely used for communications in
docs/modbus_rtu_set_rts.md
@@ -13,7 +13,7 @@ int modbus_rtu_set_rts(modbus_t *ctx, int mode) @@ -13,7 +13,7 @@ int modbus_rtu_set_rts(modbus_t *ctx, int mode)
13 ## Description 13 ## Description
14 14
15 The *modbus_rtu_set_rts()* function shall set the Request To Send mode to 15 The *modbus_rtu_set_rts()* function shall set the Request To Send mode to
16 -communicate on a RS485 serial bus. By default, the mode is set to 16 +communicate on a RS-485 serial bus. By default, the mode is set to
17 `MODBUS_RTU_RTS_NONE` and no signal is issued before writing data on the wire. 17 `MODBUS_RTU_RTS_NONE` and no signal is issued before writing data on the wire.
18 18
19 To enable the RTS mode, the values `MODBUS_RTU_RTS_UP` or `MODBUS_RTU_RTS_DOWN` 19 To enable the RTS mode, the values `MODBUS_RTU_RTS_UP` or `MODBUS_RTU_RTS_DOWN`
docs/modbus_rtu_set_serial_mode.md
@@ -15,13 +15,13 @@ int modbus_rtu_set_serial_mode(modbus_t *ctx, int mode); @@ -15,13 +15,13 @@ int modbus_rtu_set_serial_mode(modbus_t *ctx, int mode);
15 The *modbus_rtu_set_serial_mode()* function shall set the selected serial 15 The *modbus_rtu_set_serial_mode()* function shall set the selected serial
16 mode: 16 mode:
17 17
18 -- **MODBUS_RTU_RS232**, the serial line is set for RS232 communication. RS-232 18 +- **MODBUS_RTU_RS232**, the serial line is set for RS-232 communication. RS-232
19 (Recommended Standard 232) is the traditional name for a series of standards 19 (Recommended Standard 232) is the traditional name for a series of standards
20 for serial binary single-ended data and control signals connecting between a 20 for serial binary single-ended data and control signals connecting between a
21 DTE (Data Terminal Equipment) and a DCE (Data Circuit-terminating Equipment). 21 DTE (Data Terminal Equipment) and a DCE (Data Circuit-terminating Equipment).
22 It is commonly used in computer serial ports. 22 It is commonly used in computer serial ports.
23 23
24 -- **MODBUS_RTU_RS485**, the serial line is set for RS485 communication. 24 +- **MODBUS_RTU_RS485**, the serial line is set for RS-485 communication.
25 EIA-485, also known as TIA/EIA-485 or RS-485, is a standard defining the 25 EIA-485, also known as TIA/EIA-485 or RS-485, is a standard defining the
26 electrical characteristics of drivers and receivers for use in balanced 26 electrical characteristics of drivers and receivers for use in balanced
27 digital multipoint systems. This standard is widely used for communications 27 digital multipoint systems. This standard is widely used for communications
docs/modbus_set_error_recovery.md
@@ -38,7 +38,7 @@ expected one. The response timeout delay will be used to sleep. @@ -38,7 +38,7 @@ expected one. The response timeout delay will be used to sleep.
38 38
39 The modes are mask values and so they are complementary. 39 The modes are mask values and so they are complementary.
40 40
41 -It's not recommended to enable error recovery for slave/server. 41 +It's not recommended to enable error recovery for a Modbus slave/server.
42 42
43 ## Return value 43 ## Return value
44 44
docs/modbus_strerror.md
@@ -13,7 +13,7 @@ const char *modbus_strerror(int errnum); @@ -13,7 +13,7 @@ const char *modbus_strerror(int errnum);
13 ## Description 13 ## Description
14 14
15 The *modbus_strerror()* function shall return a pointer to an error message 15 The *modbus_strerror()* function shall return a pointer to an error message
16 -string corresponding to the error number specified by the `errnum` argument. As 16 +string corresponding to the error number specified by the `errnum` argument. As
17 libmodbus defines additional error numbers over and above those defined by the 17 libmodbus defines additional error numbers over and above those defined by the
18 operating system, applications should use *modbus_strerror()* in preference to 18 operating system, applications should use *modbus_strerror()* in preference to
19 the standard *strerror()* function. 19 the standard *strerror()* function.
docs/modbus_tcp_listen.md
@@ -14,7 +14,7 @@ int modbus_tcp_listen(modbus_t *ctx, int nb_connection); @@ -14,7 +14,7 @@ int modbus_tcp_listen(modbus_t *ctx, int nb_connection);
14 ## Description 14 ## Description
15 15
16 The *modbus_tcp_listen()* function shall create a socket and listen to maximum 16 The *modbus_tcp_listen()* function shall create a socket and listen to maximum
17 -`nb_connection` incoming connections on the specified IP address. The context 17 +`nb_connection` incoming connections on the specified IP address. The context
18 `ctx` must be allocated and initialized with [modbus_new_tcp](modbus_new_tcp.md) before to 18 `ctx` must be allocated and initialized with [modbus_new_tcp](modbus_new_tcp.md) before to
19 set the IP address to listen, if IP address is set to NULL or '0.0.0.0', any addresses will be 19 set the IP address to listen, if IP address is set to NULL or '0.0.0.0', any addresses will be
20 listen. 20 listen.
docs/modbus_tcp_pi_listen.md
@@ -13,7 +13,7 @@ int modbus_tcp_pi_listen(modbus_t *ctx, int nb_connection); @@ -13,7 +13,7 @@ int modbus_tcp_pi_listen(modbus_t *ctx, int nb_connection);
13 ## Description 13 ## Description
14 14
15 The *modbus_tcp_pi_listen()* function shall create a socket and listen to 15 The *modbus_tcp_pi_listen()* function shall create a socket and listen to
16 -maximum `nb_connection` incoming connections on the specified nodes. The 16 +maximum `nb_connection` incoming connections on the specified nodes. The
17 context *ctx* must be allocated and initialized with [modbus_new_tcp_pi](modbus_new_tcp_pi.md) 17 context *ctx* must be allocated and initialized with [modbus_new_tcp_pi](modbus_new_tcp_pi.md)
18 before to set the node to listen, if node is set to NULL or '0.0.0.0', any addresses will be 18 before to set the node to listen, if node is set to NULL or '0.0.0.0', any addresses will be
19 listen. 19 listen.