Skip to content

Commit d0d734a

Browse files
committed
Update README.md
1 parent ad39e63 commit d0d734a

File tree

9 files changed

+79
-32
lines changed

9 files changed

+79
-32
lines changed

README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ to work with standard Modbus Protocol.
77
Modbus Tools are a free, open-source tools with a simple user interface written in C++/Qt.
88
It implements TCP, RTU and ASCII versions of Modbus Protocol.
99

10+
### *New in version 0.4*:
11+
12+
*From now server application allows you to create program logic for the Modbus device simulator
13+
using your favorite Python programming language.*
14+
1015
Software implements such Modbus functions as:
1116
* `1 ` (`0x01`) - `READ_COILS`
1217
* `2 ` (`0x02`) - `READ_DISCRETE_INPUTS`
@@ -17,6 +22,7 @@ Software implements such Modbus functions as:
1722
* `7 ` (`0x07`) - `READ_EXCEPTION_STATUS`
1823
* `15` (`0x0F`) - `WRITE_MULTIPLE_COILS`
1924
* `16` (`0x10`) - `WRITE_MULTIPLE_REGISTERS`
25+
* `17` (`0x11`) - `REPORT_SERVER_ID` (since v0.4)
2026
* `22` (`0x16`) - `MASK_WRITE_REGISTER` (since v0.3)
2127
* `23` (`0x17`) - `READ_WRITE_MULTIPLE_REGISTERS` (since v0.3)
2228

@@ -94,6 +100,47 @@ Device contains settings for a single device (such as Modbus Unit Address, memor
94100
The DataViewItem contains a single data unit to be read/write from the device and has many formats to
95101
represent the current data. Action provides simulation capabilities (automatic change of device memory values).
96102

103+
### Scripting using Python (since v0.4)
104+
105+
Since v0.4 version 'server' application allows to extend logic of your Modbus device
106+
simulator using one the most popular programming language - Python.
107+
All you need to use scripting is installed Python interpreter and `PyQt5` library.
108+
109+
`server` application gives you access to the device's internal Modbus memory and
110+
provides `Output` window where standard output is redirected.
111+
The rest is the power of Python, its standard library, 3rd party libraries,
112+
and your own libraries and scripts.
113+
114+
Objects for access corresponding device memory: `mem0x`, `mem1x`, `mem3x`, `mem4x`.
115+
116+
Every object has set of get/set function to work with different data types:
117+
* `mem0x`, `mem1x`: `get<datatype>(bitoffset:int)->int` and `set<datatype>(bitoffset:int,value:int)`
118+
* `mem3x`, `mem4x`: `get<datatype>(regoffset:int)->int` and `set<datatype>(regoffset:int,value:int)`
119+
120+
`<datatype>`: `int8`, `uint8`, `int16`, `uint16`, `int32`, `uint32`, `int64`, `uint64`, `float`, `double`.
121+
122+
Examples:
123+
```python
124+
v = mem0x.getint8(0)
125+
mem1x.setint16(1, -1)
126+
mem3x.setuint16(0, 65535)
127+
mem4x.setdouble(10, 2.71828)
128+
```
129+
130+
Also index operation is supported.
131+
In case of discrete memory (`mem0x`, `mem1x`) it work with `boolean` values
132+
and for registers memory (`mem3x`, `mem4x`) it work with `uint16` values:
133+
134+
```python
135+
b0 = mem0x[0]
136+
mem1x[38] = True
137+
mem3x[100] = 65535
138+
if mem4x[0] > 32768:
139+
mem4x[0] = 0
140+
```
141+
142+
To view all documentation and possible uses of objects and methods, use the built-in help system.
143+
97144
### Server Actions window
98145

99146
The server has the ability to simulate/change data (actions, automaticaly change values) with predefined

doc/images/client_view.png

12.8 KB
Loading

doc/images/server_view.png

29.8 KB
Loading

src/client/win_resource.rc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
IDI_ICON1 ICON DISCARDABLE "gui\\icons\\client.ico"
44

55
VS_VERSION_INFO VERSIONINFO
6-
FILEVERSION 0,3,8,0
7-
PRODUCTVERSION 0,3,8,0
6+
FILEVERSION 0,4,0,0
7+
PRODUCTVERSION 0,4,0,0
88
FILEFLAGSMASK 0x3fL
99
#ifdef _DEBUG
1010
FILEFLAGS VS_FF_DEBUG
@@ -21,11 +21,11 @@ VS_VERSION_INFO VERSIONINFO
2121
BEGIN
2222
VALUE "CompanyName", "\0"
2323
VALUE "FileDescription", "\0"
24-
VALUE "FileVersion", "0.3.8.0\0"
24+
VALUE "FileVersion", "0.4.0.0\0"
2525
VALUE "LegalCopyright", "\0"
2626
VALUE "OriginalFilename", "client.exe\0"
2727
VALUE "ProductName", "client\0"
28-
VALUE "ProductVersion", "0.3.8.0\0"
28+
VALUE "ProductVersion", "0.4.0.0\0"
2929
END
3030
END
3131
BLOCK "VarFileInfo"

src/core/sdk/mbcore_config.h

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
#ifndef MBCORE_CONFIG_H
2-
#define MBCORE_CONFIG_H
3-
4-
/*
5-
Major part of mbtools version
6-
*/
7-
#define MBTOOLS_VERSION_MAJOR 0
8-
9-
/*
10-
Minor part of mbtools version
11-
*/
12-
#define MBTOOLS_VERSION_MINOR 4
13-
14-
/*
15-
Patch part of mbtools version
16-
*/
17-
#define MBTOOLS_VERSION_PATCH 0
18-
19-
#endif // MBCORE_CONFIG_H
1+
#ifndef MBCORE_CONFIG_H
2+
#define MBCORE_CONFIG_H
3+
4+
/*
5+
Major part of mbtools version
6+
*/
7+
#define MBTOOLS_VERSION_MAJOR 0
8+
9+
/*
10+
Minor part of mbtools version
11+
*/
12+
#define MBTOOLS_VERSION_MINOR 4
13+
14+
/*
15+
Patch part of mbtools version
16+
*/
17+
#define MBTOOLS_VERSION_PATCH 0
18+
19+
#endif // MBCORE_CONFIG_H

src/server/gui/server_ui.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,9 @@ void mbServerUi::initialize()
196196
connect(projectUi(), &mbServerProjectUi::deviceDoubleClick, this, &mbServerUi::editDeviceRef );
197197
connect(projectUi(), &mbServerProjectUi::deviceContextMenu, this, &mbServerUi::contextMenuDeviceRef);
198198

199-
// Action
200-
m_dockActions = new QDockWidget("Actions", this);
201-
m_dockActions->setObjectName(QStringLiteral("dockActions"));
199+
// Simulation Action
200+
m_dockActions = new QDockWidget("Simulation", this);
201+
m_dockActions->setObjectName(QStringLiteral("dockSimActions"));
202202
m_actionsUi = new mbServerSimActionsUi(m_dockActions);
203203
connect(m_actionsUi, &mbServerSimActionsUi::simActionContextMenu, this, &mbServerUi::contextMenuAction );
204204
m_dockActions->setWidget(m_actionsUi);

src/server/gui/server_ui.ui

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@
406406
</action>
407407
<action name="actionViewActions">
408408
<property name="text">
409-
<string>Actions</string>
409+
<string>Simulation</string>
410410
</property>
411411
</action>
412412
<action name="actionDeviceNew">

src/server/resource/python/pytips.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Object for access corresponding device memory: mem0x, mem1x, mem3x, mem4x.
1+
# Objects for access corresponding device memory: mem0x, mem1x, mem3x, mem4x.
22
#
33
# Every object has set of get/set function to work with different data types:
44
# * mem0x, mem1x: `get<datatype>(bitoffset:int)->int` and `set<datatype>(bitoffset:int,value:int)`

src/server/win_resource.rc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
IDI_ICON1 ICON DISCARDABLE "gui\\icons\\server.ico"
44

55
VS_VERSION_INFO VERSIONINFO
6-
FILEVERSION 0,3,8,0
7-
PRODUCTVERSION 0,3,8,0
6+
FILEVERSION 0,4,0,0
7+
PRODUCTVERSION 0,4,0,0
88
FILEFLAGSMASK 0x3fL
99
#ifdef _DEBUG
1010
FILEFLAGS VS_FF_DEBUG
@@ -21,11 +21,11 @@ VS_VERSION_INFO VERSIONINFO
2121
BEGIN
2222
VALUE "CompanyName", "\0"
2323
VALUE "FileDescription", "\0"
24-
VALUE "FileVersion", "0.3.8.0\0"
24+
VALUE "FileVersion", "0.4.0.0\0"
2525
VALUE "LegalCopyright", "\0"
2626
VALUE "OriginalFilename", "server.exe\0"
2727
VALUE "ProductName", "server\0"
28-
VALUE "ProductVersion", "0.3.8.0\0"
28+
VALUE "ProductVersion", "0.4.0.0\0"
2929
END
3030
END
3131
BLOCK "VarFileInfo"

0 commit comments

Comments
 (0)