TKH.S7Plus.Net
0.4.0
dotnet add package TKH.S7Plus.Net --version 0.4.0
NuGet\Install-Package TKH.S7Plus.Net -Version 0.4.0
<PackageReference Include="TKH.S7Plus.Net" Version="0.4.0" />
<PackageVersion Include="TKH.S7Plus.Net" Version="0.4.0" />
<PackageReference Include="TKH.S7Plus.Net" />
paket add TKH.S7Plus.Net --version 0.4.0
#r "nuget: TKH.S7Plus.Net, 0.4.0"
#:package TKH.S7Plus.Net@0.4.0
#addin nuget:?package=TKH.S7Plus.Net&version=0.4.0
#tool nuget:?package=TKH.S7Plus.Net&version=0.4.0
S7Plus.Net
S7Plus.NET is a .NET library for communicating with Siemens S7-1200 and S7-1500 PLCs using the extended S7 protocol. The library is based on the excellent work of Thomas Wiens in the S7CommPlusDriver project. (https://github.com/thomas-v2/S7CommPlusDriver)
Installation
The library is available as a NuGet package. You can install it using the following command:
dotnet add package TKH.S7Plus.Net
Usage
Connecting to the PLC
Create an instance of the S7Driver and connect to the PLC:
using TKH.S7Plus.Net; using System; IS7Driver driver = new S7Driver(); driver.SetTimeout(TimeSpan.FromSeconds(5)); await driver.Connect("192.168.178.140", 102);
Writing Variables
Write a boolean variable to the PLC:
using TKH.S7Plus.Net.Models; using TKH.S7Plus.Net.S7Variables; await driver.SetVariable(new S7AbsoluteAddress(1, 9), new S7VariableBool(true));
Reading Variables
Read a variable from the PLC using the symbol name:
List<Datablock> datablocks = await driver.GetDatablocks(); VariableInfo? variableInfo = await driver.GetVariableInfoBySymbol("DB1.TEST_DINT", datablocks); var variableResult = await driver.GetVariable(variableInfo!.Address);
Read an array variable from the PLC using the symbol name:
variableInfo = await driver.GetVariableInfoBySymbol("DB1.TEST_ARRAY", datablocks); variableResult = await driver.GetVariable(variableInfo!.Address); S7VariableDIntArray dintArray = (S7VariableDIntArray)variableResult; Console.WriteLine($"Value of DB1.TEST_ARRAY: {string.Join(", ", dintArray.Value)}");
Disconnecting from the PLC
Disconnect from the PLC:
driver.Disconnect();
Commercially Supported
This library is commercially supported by TKH Software. Don't hesitate contacting us if you're building something large, in need of advice or having other business inquiries in mind.
License
This project is licensed under the LGPL-3.0 License.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- BouncyCastle.Cryptography (>= 2.4.0)
- Microsoft.Extensions.Logging (>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.