Skip to content

Commit 9b4b126

Browse files
committed
Version 0.3.0
2 parents 93bca6c + 79429ee commit 9b4b126

File tree

303 files changed

+14302
-5687
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

303 files changed

+14302
-5687
lines changed

.gitignore

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# Ignore Qt-Project user files
22
*.user
3-
4-
#ignore vscode
53
.vscode/
6-
74
tests/
5+
doc/output/client
6+
doc/output/server
7+
TODO
88

9-
TODO
9+
#ignore only cmake presets in root folder
10+
/CMakePresets.json

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required(VERSION 3.5) # 2.2 - case insensitive syntax
22

3-
project(ModbusTools VERSION 0.2.2 LANGUAGES CXX)
3+
project(ModbusTools VERSION 0.3.0 LANGUAGES CXX)
44

55
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
66
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")

README.md

Lines changed: 231 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,56 +5,272 @@
55
ModbusTools are cross-platform (Windows, Linux) Modbus simulator tools (client and server) with GUI to work with standard Modbus Protocol. Modbus Tools are a free, open-source tools with a simple user interface written in C++/Qt. It implements TCP, RTU and ASCII versions of Modbus Protocol.
66

77
Software implements such Modbus functions as:
8-
* 1 (0x01) - `READ_COILS`
9-
* 2 (0x02) - `READ_DISCRETE_INPUTS`
10-
* 3 (0x03) - `READ_HOLDING_REGISTERS`
11-
* 4 (0x04) - `READ_INPUT_REGISTERS`
12-
* 5 (0x05) - `WRITE_SINGLE_COIL`
13-
* 6 (0x06) - `WRITE_SINGLE_REGISTER`
14-
* 7 (0x07) - `READ_EXCEPTION_STATUS`
15-
* 15 (0x0F) - `WRITE_MULTIPLE_COILS`
16-
* 16 (0x10) - `WRITE_MULTIPLE_REGISTERS`
8+
* `1 ` (`0x01`) - `READ_COILS`
9+
* `2 ` (`0x02`) - `READ_DISCRETE_INPUTS`
10+
* `3 ` (`0x03`) - `READ_HOLDING_REGISTERS`
11+
* `4 ` (`0x04`) - `READ_INPUT_REGISTERS`
12+
* `5 ` (`0x05`) - `WRITE_SINGLE_COIL`
13+
* `6 ` (`0x06`) - `WRITE_SINGLE_REGISTER`
14+
* `7 ` (`0x07`) - `READ_EXCEPTION_STATUS`
15+
* `15` (`0x0F`) - `WRITE_MULTIPLE_COILS`
16+
* `16` (`0x10`) - `WRITE_MULTIPLE_REGISTERS`
17+
* `22` (`0x16`) - `MASK_WRITE_REGISTER` (since v0.3)
18+
* `23` (`0x17`) - `WRITE_MULTIPLE_REGISTERS` (since v0.3)
1719

1820
ModbusTools work with Qt Framework version 5 (5.8 or later).
1921
It based on `ModbusLib` cross platform library project:
2022

2123
https://github.com/serhmarch/ModbusLib
2224

25+
## Release
26+
27+
All compiled binaries are located in latest release.
2328

2429
## About Modbus Client
2530

2631
The client implements access to a remote Modbus device. However, the client can work not only with one device, but with several devices that can be connected to a single network, which is especially useful when working with RTU and ASCII protocols, when access to all Modbus servers is realized through a single serial port. However, it can also be useful when using the TCP version of the protocol, for example, if you use the TCP->RTU bridge.
2732

33+
![](./doc/images/client_view.png)
34+
2835
All work is done within a single project. The main entities in the project are Port, Device and DataViewItem. Port contains network settings for both TCP/IP and serial ports. Device contains settings for a single device (such as Modbus Unit Address, etc.). The DataViewItem contains a single data unit to be read from the remote device and has many formats to represent the current data.
29-
![ModbusClient-img001](./help/client/ModbusClient-img/ModbusClient-img001.png)
36+
37+
### Send Message window
3038

3139
The client has the ability to process one separate Modbus function with full configuration of the parameters of this function, view/edit read/write data with the format specified, view Modbus packets of this function:
3240

33-
![ModbusClient-img017](./help/client/ModbusClient-img/ModbusClient-img017.png)
41+
![](./doc/images/client_sendmessage_window.png)
42+
43+
This window can be opened using menu `Runtime->Send Message` in run mode. It works in parallel with regular Modbus application messages and can be seen in LogView as regular Modbus message as well.
44+
45+
### Scanner window (since v0.3)
46+
47+
`Scanner` tool window is intended to scan Modbus network to determine which device
48+
with current settings are present in the network.
49+
50+
![](./doc/images/client_scanner_window.png)
51+
52+
Scanner scans Modbus network in range [`UnitStart`:`UnitEnd`] with `tries` attempts count.
53+
The request can be customized using `Scanner Request`-dialog,
54+
which is called using `...` button in `Request` field.
55+
56+
There is a list of founded devices in central widget.
57+
Founded devices can be add to the current project:
58+
button `To Project` add selected devices, `All To Project` - all devices will be added to the project.
3459

3560
## About Modbus Server
3661

3762
The server implements Modbus server device and works like Modbus simulator. However, the server can not only simulate single device, but can simulate several devices that can be connected to a single network, which is especially useful when working with RTU and ASCII protocols, when access to all Modbus servers is realized through a single serial port. However, it can also be useful to simulate Modbus network using the TCP version of the protocol, for example, if you use the TCP->RTU bridge, Modbus server can replace this bridge with remote devices for testing purposes.
3863

64+
![](./doc/images/server_view.png)
65+
3966
All work is performing within a single project. The main entities in the project are Port, Device, DataViewItem and Action. Port contains network settings for both TCP/IP and serial ports. Device contains settings for a single device (such as Modbus Unit Address, memory size etc). The DataViewItem contains a single data unit to be read/write from the device and has many formats to represent the current data. Action provides simulation capabilities (automatic change of device memory values).
4067

41-
![ModbusServer-img001](./help/server/ModbusServer-img/ModbusServer-img001.png)
68+
### Server Actions window
4269

4370
The server has the ability to simulate data (actions, automaticaly change values) with predefined action types (`Actions` tab near `LogView`, menu `View->Actions` window and menu `Actions`):
4471
* `Increment` - changing value by adding or subtracting (if incrementValue < 0) incrementValue
4572
* `Sine` - sine function with parameters of period, shift, amplitude
4673
* `Random` - randomly changing values with specified range
74+
* `Copy` - move data from one memory part to another (with same or different memory types)
4775

48-
![ModbusServer-img010](./help/server/ModbusServer-img/ModbusServer-img010.png)
76+
![](./doc/images/server_actions_window.png)
4977

5078
## Binary
5179

5280
Modbus Tools binary using Qt5.8 version of the framework or later.
5381
Modbus Tools was compiled for Windows 64 bit and Ubuntu 22.04.
5482
Binary files are located in <root>/bin/
5583

56-
## Build
84+
## Building ModbusTools from source on Windows
85+
86+
### Preparation
87+
88+
The ModbusTools project requires Qt version 5.8 or later.
89+
90+
1. Download qt-online-installer, follow the link and choose Windows version for installer:
91+
92+
https://www.qt.io/download-qt-installer
93+
94+
2. Run qt-online-installer and install all necessary components: Qt 5 (Qt5.15.2) framework.
95+
96+
Qt 5.8 or higher is needed so in `Select Components` window check `Archive` checkbox and push `Filter` button.
97+
Then is better to check latest version of Qt5.15 fr (e.g. 5.15.2)
98+
99+
3. Download and install git for Windows or use WSL and install git for WSL.
100+
101+
4. Make dir for binaries, e.g. in `<user-home-dir>\bin\ModbusTools` using Windows command console:
102+
```console
103+
>cd `<user-home-dir>`
104+
>mkdir bin\ModbusTools
105+
>cd bin\ModbusTools
106+
```
107+
108+
### Build using qmake
109+
110+
This example shows how to build `ModbusTools` for MSVC compiler using `qmake`.
111+
112+
1. Open Windows command console and initialize all MSVC compiler vars (e.g. include, lib) using `vcvarsall.bat` script.
113+
This script will be configured for x64 arch (use `...\vcvarsall.bat -help` to display all options):
114+
```console
115+
>"c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
116+
```
117+
118+
2. Run qmake to produce `Makefile`.
119+
This command will make `Release` version, for `Debug` replase with `"CONFIG+=debug"`:
120+
```console
121+
>C:\Qt\5.15.2\msvc2019_64\bin\qmake.exe path\to\ModbusTools.pro -spec win32-msvc "CONFIG+=release"
122+
```
123+
124+
3. Produce all make files:
125+
```console
126+
>C:\Qt\Tools\QtCreator\bin\jom\jom.exe -f Makefile qmake_all
127+
```
128+
129+
4. Build project from Makefile's:
130+
```console
131+
>C:\Qt\Tools\QtCreator\bin\jom\jom.exe
132+
```
133+
134+
### Build using cmake
135+
136+
1. Run cmake to generate project (make) files.
137+
`CMAKE_PREFIX_PATH` must be set to installed Qt framewrok files:
138+
```console
139+
>cmake -DCMAKE_PREFIX_PATH:PATH=C:/Qt/5.15.2/msvc2019_64 -S path\to\ModbusTools -B .
140+
```
141+
2. Make binaries (+ debug|release config):
142+
```console
143+
$ cmake --build .
144+
$ cmake --build . --config Debug
145+
$ cmake --build . --config Release
146+
```
147+
148+
3. Resulting bin files is located in `Debug` or `Release` directory.
149+
150+
#### Build using CMakePresets.json
151+
152+
```console
153+
cmake --preset "Win64-MSVC-Debug"
154+
cmake --build --preset "Win64-MSVC-Debug"
155+
156+
cmake --preset "Win64-MSVC-Release"
157+
cmake --build --preset "Win64-MSVC-Release"
158+
```
159+
160+
## Building ModbusTools from source on Linux
161+
162+
### Preparation
163+
164+
The ModbusTools project requires Qt version 5.8 or later.
165+
166+
1. Update package list:
167+
```console
168+
$ sudo apt-get update
169+
```
170+
171+
2. Install main build tools like g++, make etc:
172+
```console
173+
$ sudo apt-get install build-essential
174+
```
175+
176+
3. Install Qt tools:
177+
```console
178+
$ sudo apt-get install qtbase5-dev qttools5-dev
179+
```
180+
181+
4. Check for correct instalation:
182+
```console
183+
$ whereis qmake
184+
qmake: /usr/bin/qmake
185+
$ whereis libQt5Core*
186+
libQt5Core.prl: /usr/lib/x86_64-linux-gnu/libQt5Core.prl
187+
libQt5Core.so: /usr/lib/x86_64-linux-gnu/libQt5Core.so
188+
libQt5Core.so.5: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
189+
libQt5Core.so.5.15: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.15
190+
libQt5Core.so.5.15.3: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.15.3
191+
$ whereis libQt5Help*
192+
libQt5Help.prl: /usr/lib/x86_64-linux-gnu/libQt5Help.prl
193+
libQt5Help.so: /usr/lib/x86_64-linux-gnu/libQt5Help.so
194+
libQt5Help.so.5: /usr/lib/x86_64-linux-gnu/libQt5Help.so.5
195+
libQt5Help.so.5.15: /usr/lib/x86_64-linux-gnu/libQt5Help.so.5.15
196+
libQt5Help.so.5.15.3: /usr/lib/x86_64-linux-gnu/libQt5Help.so.5.15.3
197+
```
198+
199+
5. Install git:
200+
```console
201+
$ sudo apt-get install git
202+
```
203+
204+
6. Create project directory, move to it and clone repository:
205+
```console
206+
$ cd ~
207+
$ mkdir src
208+
$ cd src
209+
$ git clone --recursive https://github.com/serhmarch/ModbusTools.git
210+
```
211+
212+
7. Create and/or move to directory for build output, e.g. `~/bin/ModbusTools`:
213+
```console
214+
$ cd ~
215+
$ mkdir -p bin/ModbusTools
216+
$ cd bin/ModbusTools
217+
```
218+
219+
### Build using qmake
220+
221+
1. Run qmake to create Makefile for build:
222+
```console
223+
$ qmake ~/src/ModbusTools/src/ModbusTools.pro -spec linux-g++
224+
```
225+
226+
2. To ensure Makefile was created print:
227+
```console
228+
$ ls -l
229+
total 36
230+
-rw-r--r-- 1 march march 35001 May 6 18:41 Makefile
231+
```
232+
3. Finaly to make current set of programs print:
233+
```console
234+
$ make
235+
```
236+
237+
4. After build step move to `<build_folder>/bin` to ensure everything is correct:
238+
```console
239+
$ cd bin
240+
$ pwd
241+
~/bin/ModbusTools/bin
242+
$ ls -l
243+
total 2672
244+
-rwxr-xr-x 1 march march 643128 May 6 18:45 client
245+
lrwxrwxrwx 1 march march 16 May 6 18:44 libcore.so -> libcore.so.0.1.4
246+
lrwxrwxrwx 1 march march 16 May 6 18:44 libcore.so.0 -> libcore.so.0.1.4
247+
lrwxrwxrwx 1 march march 16 May 6 18:44 libcore.so.0.1 -> libcore.so.0.1.4
248+
-rwxr-xr-x 1 march march 993376 May 6 18:44 libcore.so.0.1.4
249+
-rwxr-xr-x 1 march march 907872 May 6 18:47 server
250+
```
251+
### Build using cmake
252+
253+
1. Run cmake to generate project (make) files.
254+
```console
255+
$ cmake -S ~/src/ModbusTools -B .
256+
```
257+
258+
2. Make binaries (+ debug|release config):
259+
```console
260+
$ cmake --build .
261+
$ cmake --build . --config Debug
262+
$ cmake --build . --config Release
263+
```
264+
265+
3. Resulting bin files is located in `./bin` directory.
266+
267+
#### Build using CMakePresets.json
268+
269+
```console
270+
cmake --preset "Linux-Debug"
271+
cmake --build --preset "Linux-Debug"
57272

58-
Build intructions is located in `bin` folder, e.g. `./bin/Ubuntu/README.md`
273+
cmake --preset "Linux-Release"
274+
cmake --build --preset "Linux-Release"
59275

60276

0 commit comments

Comments
 (0)