Skip to content

Commit ed979cd

Browse files
committed
Update docs
1 parent b285baf commit ed979cd

File tree

9 files changed

+82
-43
lines changed

9 files changed

+82
-43
lines changed

doc/images/client_port_dialog.png

2.17 KB
Loading

doc/images/client_port_dialogx.png

7.19 KB
Loading
-2.22 KB
Loading

doc/images/server_port_dialog.png

3.25 KB
Loading

doc/images/server_port_dialogx.png

10.1 KB
Loading
-2.15 KB
Loading

doc/input/client/client.md

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
\page sec_client Client
22

33
# About Modbus Client
4-
The client implements access to a remote Modbus device. However, the client can work not only with one device,
5-
but with several devices that can be connected to a single network, which is especially useful when working
6-
with RTU and ASCII protocols, when access to all Modbus servers is realized through a single serial port.
7-
However, it can also be useful when using the TCP version of the protocol, for example, if you use the TCP->RTU bridge.
8-
9-
All work is done within a single project. The main entities in the project are Port, Device and DataViewItem.
10-
Port contains network settings for both TCP/IP and serial ports. Device contains settings for a single device
11-
(such as Modbus Unit Address, etc.). The DataViewItem contains a single data unit to be read from the remote
4+
5+
The client implements access to a remote Modbus device.
6+
However, the client can work not only with one device,
7+
but with several devices that can be connected to a single network,
8+
which is especially useful when working with RTU and ASCII protocols,
9+
when access to all Modbus servers is realized through a single serial port.
10+
However, it can also be useful when using the TCP version of the protocol,
11+
for example, if you use the TCP->RTU bridge.
12+
13+
All work is performed within a single project.
14+
The main entities in the project are Port, Device and DataViewItem.
15+
Port contains network settings for both TCP/IP and serial ports.
16+
Device contains settings for a single device (such as Modbus Unit Address, etc.).
17+
The DataViewItem contains a single data unit to be read from the remote
1218
device and has many formats to represent the current data.
1319

1420
# Quickstart
@@ -31,8 +37,9 @@ In this dialog box, you can set the network settings for the port.
3137

3238
## Device
3339

34-
To change the device settings, you need to double click left mouse button on the device name in the project tree
35-
(or use the menu `Device->Edit Device...`). The device must be selected in the project tree. To add a new device,
40+
To change the device settings, you need to double click left mouse button on the device name
41+
in the project tree (or use the menu `Device->Edit Device...`).
42+
The device must be selected in the project tree. To add a new device,
3643
select `Device->New Device...` or `Port->New Device...` to immediately bind this device to the selected port.
3744

3845
![](client_device_dialog.png)
@@ -276,9 +283,17 @@ In this window individual message parameters can be set such as data address and
276283
and message response data can be reviewed with different formats. Message transmit (Tx) and
277284
receive (Rx) byte data can be viewed in corresponding `Tx` and `Rx`- labels.
278285

279-
Message data (bits and registers values) separated by comma with specified format can be viewed in the Data window for read function and set for write functions.
286+
`Device/Port` switch allows to choose message recipient: specified device or
287+
port with unit address (useful for `unit=0` broadcast address)
288+
289+
Message data (bits and registers values) separated by comma with specified format
290+
can be viewed in the Data window for read function and set for write functions.
280291

281-
* `Device` - device which message will belong to;
292+
* `Device` - device which message will belong to (in case of `Device` switch on);
293+
* `Port` - port which message will belong to (in case of `Port/Unit` switch on);
294+
* `Unit` - unit/slave address to which the message will be sent
295+
(in case of `Port/Unit` switch on).
296+
`unit=0` indended for broadcast address (if `Enable Broadcast` is set in the port settings);
282297

283298
* `Function` - supported Modbus functions such as:
284299
* `1 ` (`0x01`) - `READ_COILS`
@@ -367,7 +382,7 @@ For port it displays port main settings, for device it displays device reference
367382
(Modbus device unit address(es) ).
368383

369384
* `Modbus adr. notation` - using this setting item address representation can be changed:
370-
`Modbus (1-based)` or `IEC 61131-3 (0-based)`
385+
`Modbus (1-based)`, `IEC 61131-3 (0-based)` or `IEC 61131-3 Hex (0-based)`.
371386

372387
### DataView
373388

@@ -427,6 +442,8 @@ Assumed that date and time are 21 May 2001 14:13:09.120.
427442
* `Timeout (first byte)` - timeout waiting first byte for serial port;
428443
* `Timeout (inter byte)` - timeout waiting next bytes after first bytes was received,
429444
after this timeout completes Modbus packet consider finished and return to process.
445+
* `Enable broadcast for 0-unit address` - if option is set then `0`-unit address
446+
will be recognized as broadcast and no response will be expected.
430447

431448
## Device dialog
432449

doc/input/mainpage.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ __*New in version 0.4*__:
3636
> IEC61131-3 addressing type is available. There is a setting that allows you to choose between
3737
standard Modbus (1 based) and IEC61131-3 (0 based) addressing types.
3838

39+
__*New in version 0.4.1*__:
40+
> IEC61131-3 Hex (0 based) addressing type is available, e.g. `%I0000h`, `%Q001Fh`, `%IW0B7Ch`, `%MW1A01h`.
41+
3942
Memory types decribed below:
4043

4144
* `0x` - intended for coils (discrete outputs, boolean), corresponding modern PLC notation is `%%M` or `%%Q`
@@ -55,9 +58,9 @@ corresponding access function is `READ_INPUT_REGISTERS`(`4`);
5558
corresponding access functions are `READ_HOLDING_REGISTERS`(`3`) and `WRITE_MULTIPLE_REGISTERS`(`16`, `0x10`);
5659

5760
Addressing examples:
58-
| Memory type | Standard (1 based) | IEC 61131-3 (0 based)
59-
|-------------------|--------------------|-------------------------
60-
| Coils | `000001` | `%%Q0`
61-
| Discrete inputs | `100001` | `%%I0`
62-
| Input registers | `300001` | `%%IW0`
63-
| Holding registers | `400001` | `%%MW0`
61+
| Memory type | Standard (1 based) | IEC 61131-3 (0 based)| IEC 61131-3 Hex (0 based)
62+
|-------------------|--------------------|----------------------|---------------------------
63+
| Coils | `000001` | `%Q0` | `%Q0000h`
64+
| Discrete inputs | `100016` | `%I15` | `%I000Fh`
65+
| Input registers | `300017` | `%IW16` | `%IW0010h`
66+
| Holding registers | `406658` | `%MW6657` | `%MW1A01h`

doc/input/server/server.md

Lines changed: 43 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@
33
# About Modbus Server {#sec_server_about}
44

55
The server implements Modbus server device and works like Modbus simulator.
6-
However, the server can not only simulate single device, but can simulate several devices that can be connected to
7-
a single network, which is especially useful when working with RTU and ASCII protocols,
8-
when access to all Modbus servers
9-
is realized through a single serial port. However, it can also be useful to simulate Modbus network using the
10-
TCP version of the protocol, for example, if you use the TCP->RTU bridge, Modbus server can replace this bridge with
11-
remote devices for testing purposes.
12-
13-
All work is performing within a single project. The main entities in the project are Port, Device,
14-
DataViewItem and Action.
15-
Port contains network settings for both TCP/IP and serial ports. Device contains settings for a single device
6+
However, the server can not only simulate single device, but can simulate
7+
several devices that can be connected to a single network,
8+
which is especially useful when working with RTU and ASCII protocols,
9+
when access to all Modbus servers is realized through a single serial port.
10+
However, it can also be useful to simulate Modbus network using the
11+
TCP version of the protocol, for example, if you use the TCP->RTU bridge,
12+
Modbus server can replace this bridge with remote devices for testing purposes.
13+
14+
All work is performed within a single project.
15+
The main entities in the project are Port, Device, DataViewItem and Action.
16+
Port contains network settings for both TCP/IP and serial ports.
17+
Device contains settings for a single device
1618
(such as Modbus Unit Address, memory size etc).
1719
The DataViewItem contains a single data unit to be read/write from the device and has many formats to represent
1820
the current data. Action provides simulation capabilities (automatic change of device memory values).
@@ -447,7 +449,7 @@ For port it displays port main settings, for device it displays device reference
447449
(Modbus device unit address(es) ).
448450

449451
* `Modbus adr. notation` - using this setting item address representation can be changed:
450-
`Modbus (1-based)` or `IEC 61131-3 (0-based)`
452+
`Modbus (1-based)`, `IEC 61131-3 (0-based)` or `IEC 61131-3 Hex (0-based)`.
451453

452454
### DataView
453455

@@ -480,12 +482,16 @@ Assumed that date and time are 21 May 2001 14:13:09.120.
480482
#### Runtime
481483

482484
* `Enable Python Script` - enables/disables Python script execution.
483-
* `Use optimization` - enables/disables Python script source file generation.
485+
* `Use Optimization` - enable/disable caching of script file generation;
486+
* `Loop period` - `Loop`-script execution period (in millisec);
484487

485488
#### Editor
486489

487490
* `Generate usage examples in comments` - generate examples of script usage in comment in the head of script.
488491
Maybe useful for first time using script.
492+
* `Word Wrap` - enable/disable word wrap;
493+
* `Line Numbers` - enable/disable `Line Numbers` panel;
494+
* `Tab Spaces` - count of `Space` symbols for `Tab`-button;
489495
* `Font` - font setting for script source code displaying.
490496
* `Color` - color setting for script source code displaying.
491497
Included color schema for every time of script lexema (editing by mouse double-click)
@@ -529,6 +535,8 @@ Window for managing interpreter installed in operation system.
529535
* `Timeout (first byte)` - timeout waiting first byte for serial port;
530536
* `Timeout (inter byte)` - timeout waiting next bytes after first bytes was received,
531537
after this timeout completes Modbus packet consider finished and return to process.
538+
* `Enable broadcast for 0-unit address` - if option is set then `0`-unit address
539+
will be recognized as broadcast and no response will be send.
532540

533541
## Device dialog
534542

@@ -686,10 +694,10 @@ Every object has set of get/set function to work with different data types:
686694

687695
Examples:
688696
```python
689-
v = mem0x.getint8(0)
690-
mem1x.setint16(1, -1)
691-
mem3x.setuint16(0, 65535)
692-
mem4x.setdouble(10, 2.71828)
697+
v = mem0x.getint8(0)
698+
mem1x.setint16(1, -1)
699+
mem3x.setuint16(0, 65535)
700+
mem4x.setdouble(10, 2.71828)
693701
```
694702

695703
Also index operation is supported.
@@ -708,18 +716,29 @@ Scripting gives you access into current device settings by global object `mbdevi
708716
which has type `mbserver._MbDevice`. Example of usage:
709717

710718
```
711-
print("Device name is " + mbdevice.getname())
712-
print("Device exception status is " + hex(mbdevice.getexcstatus()))
713-
print("Device count of coils is " + hex(mbdevice.getcount0x()))
714-
print("Device count of discrete inputs is " + hex(mbdevice.getcount1x()))
715-
print("Device count of input registers is " + hex(mbdevice.getcount3x()))
716-
print("Device count of holding registers is " + hex(mbdevice.getcount4x()))
719+
print("Device name is " + mbdevice.getname())
720+
print("Device exception status is " + hex(mbdevice.getexcstatus()))
721+
print("Device count of coils is " + hex(mbdevice.getcount0x()))
722+
print("Device count of discrete inputs is " + hex(mbdevice.getcount1x()))
723+
print("Device count of input registers is " + hex(mbdevice.getcount3x()))
724+
print("Device count of holding registers is " + hex(mbdevice.getcount4x()))
725+
```
726+
727+
Also `mem0x`, `mem1x`, `mem3x`, `mem4x` can be accessed through `mbdevice` object:
728+
729+
```py
730+
new_mem0x_ref = mbdevice.getmem0x()
731+
new_mem1x_ref = mbdevice.getmem1x()
732+
new_mem3x_ref = mbdevice.getmem3x()
733+
new_mem4x_ref = mbdevice.getmem4x()
717734
```
718735

719736
## Python `import` directories
720737

721738
You need to use Python modules in case of big simulation projects.
722-
Or maybe you want to use you own Python modules for different devices within
739+
Or maybe you want to use your own Python modules for different devices within
723740
single project or for different projects.
741+
724742
By default server add directory `<your_bin_folder>/script/server` into import path.
725-
Also current folder where `*.pjs` project file is located added into import path.
743+
744+
Also current folder (where `*.pjs` project file is located) is added into import path.

0 commit comments

Comments
 (0)