Skip to content

Commit c03433d

Browse files
ADD: Modbus Client
1 parent 68ca432 commit c03433d

File tree

11 files changed

+1768
-0
lines changed

11 files changed

+1768
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Collection of classes and examples that are mainly related to Serial and Network
3434
| --- | --- |
3535
| MQTT_Broker | Shows a implementation of uMQTTbroker.pas (only publish / subscibe no evaluations) |
3636
| MQTT_Publisher | Demo that can send MQTT Publish messages to a given IP-Address (no security login) |
37+
| Modbus_Client | Application to emulate a MODBUS-Slave device |
3738
| Modbus_Diagnostic | Shows a implementation for the MODBUS RTU, MODBUS-TCP and MODBUS-TCP RTU version, use to detect address offset and encoding of the MODBUS SLAVE |
3839
| uMQTTbroker.pas | a simpliest MQTT broker, only capable of receiving publishing clients (need L-Net) |
3940
| uchunkmanager.pas | Server / Client component to send packages of data through a TCP-IP connection (need L-Net) |

TCP_IP/Modbus_Client/Readme.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Modbus Client
2+
3+
This application emulates a MODBUS Slave device with all possible registers.
4+
5+
![](preview.png)
6+
7+
Features:
8+
- Modbus RTU
9+
- Mudbus TCP (multiple Masters possible)
10+
- 65536 Registers
11+
- Storing / loading of Register dump

TCP_IP/Modbus_Client/preview.png

30 KB
Loading

TCP_IP/Modbus_Client/project1.lpi

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<CONFIG>
3+
<ProjectOptions>
4+
<Version Value="12"/>
5+
<PathDelim Value="\"/>
6+
<General>
7+
<Flags>
8+
<CompatibilityMode Value="True"/>
9+
</Flags>
10+
<SessionStorage Value="InProjectDir"/>
11+
<Title Value="project1"/>
12+
<ResourceType Value="res"/>
13+
<UseXPManifest Value="True"/>
14+
</General>
15+
<i18n>
16+
<EnableI18N LFM="False"/>
17+
</i18n>
18+
<BuildModes Count="1">
19+
<Item1 Name="Default" Default="True"/>
20+
</BuildModes>
21+
<PublishOptions>
22+
<Version Value="2"/>
23+
</PublishOptions>
24+
<RunParams>
25+
<FormatVersion Value="2"/>
26+
<Modes Count="1">
27+
<Mode0 Name="default"/>
28+
</Modes>
29+
</RunParams>
30+
<RequiredPackages Count="3">
31+
<Item1>
32+
<PackageName Value="lnetvisual"/>
33+
</Item1>
34+
<Item2>
35+
<PackageName Value="lnetbase"/>
36+
</Item2>
37+
<Item3>
38+
<PackageName Value="LCL"/>
39+
</Item3>
40+
</RequiredPackages>
41+
<Units Count="9">
42+
<Unit0>
43+
<Filename Value="project1.lpr"/>
44+
<IsPartOfProject Value="True"/>
45+
</Unit0>
46+
<Unit1>
47+
<Filename Value="unit1.pas"/>
48+
<IsPartOfProject Value="True"/>
49+
<ComponentName Value="Form1"/>
50+
<HasResources Value="True"/>
51+
<ResourceBaseClass Value="Form"/>
52+
<UnitName Value="Unit1"/>
53+
</Unit1>
54+
<Unit2>
55+
<Filename Value="..\..\synapse\synaser.pas"/>
56+
</Unit2>
57+
<Unit3>
58+
<Filename Value="umodbus.pas"/>
59+
<IsPartOfProject Value="True"/>
60+
</Unit3>
61+
<Unit4>
62+
<Filename Value="unit2.pas"/>
63+
<IsPartOfProject Value="True"/>
64+
<ComponentName Value="Form2"/>
65+
<HasResources Value="True"/>
66+
<ResourceBaseClass Value="Form"/>
67+
<UnitName Value="Unit2"/>
68+
</Unit4>
69+
<Unit5>
70+
<Filename Value="..\..\DatenSteuerung\uuart.pas"/>
71+
<IsPartOfProject Value="True"/>
72+
</Unit5>
73+
<Unit6>
74+
<Filename Value="uuart.inc"/>
75+
<IsPartOfProject Value="True"/>
76+
</Unit6>
77+
<Unit7>
78+
<Filename Value="..\..\DatenSteuerung\ufifo.pas"/>
79+
<IsPartOfProject Value="True"/>
80+
</Unit7>
81+
<Unit8>
82+
<Filename Value="..\..\DatenSteuerung\ucrc.pas"/>
83+
<IsPartOfProject Value="True"/>
84+
</Unit8>
85+
</Units>
86+
</ProjectOptions>
87+
<CompilerOptions>
88+
<Version Value="11"/>
89+
<PathDelim Value="\"/>
90+
<Target>
91+
<Filename Value="Modbus_Client"/>
92+
</Target>
93+
<SearchPaths>
94+
<IncludeFiles Value="$(ProjOutDir)"/>
95+
<OtherUnitFiles Value="..\..\synapse;..\..\DatenSteuerung"/>
96+
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
97+
</SearchPaths>
98+
<Linking>
99+
<Debugging>
100+
<UseHeaptrc Value="True"/>
101+
</Debugging>
102+
<Options>
103+
<Win32>
104+
<GraphicApplication Value="True"/>
105+
</Win32>
106+
</Options>
107+
</Linking>
108+
</CompilerOptions>
109+
<Debugging>
110+
<Exceptions Count="3">
111+
<Item1>
112+
<Name Value="EAbort"/>
113+
</Item1>
114+
<Item2>
115+
<Name Value="ECodetoolError"/>
116+
</Item2>
117+
<Item3>
118+
<Name Value="EFOpenError"/>
119+
</Item3>
120+
</Exceptions>
121+
</Debugging>
122+
</CONFIG>

TCP_IP/Modbus_Client/project1.lpr

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
(******************************************************************************)
2+
(* *)
3+
(* Author : Uwe Schächterle (Corpsman) *)
4+
(* *)
5+
(* This file is part of Modbus Client *)
6+
(* *)
7+
(* See the file license.md, located under: *)
8+
(* https://github.com/PascalCorpsman/Software_Licenses/blob/main/license.md *)
9+
(* for details about the license. *)
10+
(* *)
11+
(* It is not allowed to change or remove this text from any *)
12+
(* source file of the project. *)
13+
(* *)
14+
(******************************************************************************)
15+
Program project1;
16+
17+
{$MODE objfpc}{$H+}
18+
19+
Uses
20+
{$IFDEF UNIX}
21+
cthreads,
22+
{$ENDIF}
23+
Interfaces, // this includes the LCL widgetset
24+
Forms, lnetbase, lnetvisual, Unit1, Unit2
25+
{ you can add units after this };
26+
27+
{$R *.res}
28+
29+
Begin
30+
RequireDerivedFormResource := True;
31+
Application.Initialize;
32+
Application.CreateForm(TForm1, Form1);
33+
Application.CreateForm(TForm2, Form2);
34+
Application.Run;
35+
End.
36+

0 commit comments

Comments
 (0)