Skip to content

Commit 22bbe09

Browse files
Reformat docs as markdown and correct spelling errors
1 parent d7656c5 commit 22bbe09

File tree

4 files changed

+82
-100
lines changed

4 files changed

+82
-100
lines changed

docs/modbus_read_file_record.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# modbus_read_file_record
2+
3+
## Name
4+
5+
modbus_read_file_record - Read records from a file
6+
7+
## Synopsis
8+
9+
```c
10+
int modbus_read_file_record(modbus_t *'ctx', int 'addr', int 'sub_addr', int 'nb', uint16_t * 'dest');
11+
```
12+
13+
## Description
14+
15+
The *modbus_read_file_record()* function reads `nb` records from file
16+
number `addr`, starting from record position `sub_addr` in the file.
17+
The result of reading is stored in `dest` array as word values (16 bits). You
18+
must take care to allocate enough memory to store the results in `dest`
19+
- (at least `nb * sizeof(uint16_t)`).
20+
21+
A file is an array of records, each of 16 bits.
22+
23+
* A ModBus device may have up to 65535 files, addressed 1 to 65535 decimal.
24+
* Each file contains 10000 records, addressed 0000 to 9999 decimal.
25+
26+
A maximum of 124 records (`nb`) may be retrieved in a single request.
27+
28+
This function uses the ModBus function code 0x14 (Read File Record). Note that
29+
although the ModBus Specification allows for multiple non-contiguous reads in
30+
the same file to be made in a single request, this function only supports a
31+
single contiguous read request.
32+
33+
34+
## Return value
35+
36+
The function shall return the number of records read (i.e. the value of `nb`) if successful.
37+
Otherwise it shall return -1 and set errno.
38+
39+
40+
## See also
41+
42+
- [modbus_read_register](modbus_read_register.md)
43+
- [modbus_write_file_record](modbus_write_file_record.md)

docs/modbus_read_file_record.txt

Lines changed: 0 additions & 51 deletions
This file was deleted.

docs/modbus_write_file_record.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
modbus_write_file_record
2+
3+
## Name
4+
5+
modbus_write_file_record - Write records to a file
6+
7+
## Synopsis
8+
9+
```c
10+
int modbus_write_file_record(modbus_t *'ctx', int 'addr', int 'sub_addr', int 'nb', const uint16_t * 'src');
11+
```
12+
13+
## Description
14+
15+
The *modbus_write_file_record()* function writes the content of `nb`
16+
records from the `src` array to file number `addr`, starting from position
17+
`sub_addr` in the file.
18+
19+
A file is an array of records, each of 16 bits.
20+
21+
* A ModBus device may have up to 65535 files, addressed 1 to 65535 decimal.
22+
* Each file contains 10000 records, addressed 0000 to 9999 decimal.
23+
24+
A maximum of 124 records (`nb`) may be written in a single request.
25+
26+
This function uses the ModBus function code 0x15 (Write File Record). Note that
27+
although the ModBus Specification allows for multiple non-contiguous writes in
28+
the same file to be made in a single request, this function only supports a
29+
single contiguous write request.
30+
31+
## Return value
32+
33+
The function shall return the number of records written (i.e. the value of `nb`) if successful.
34+
Otherwise it shall return -1 and set errno.
35+
36+
## See also
37+
38+
- [modbus_write_register](modbus_write_register.md)
39+
- [modbus_read_file_record](modbus_read_file_record.md)

docs/modbus_write_file_record.txt

Lines changed: 0 additions & 49 deletions
This file was deleted.

0 commit comments

Comments
 (0)