Siemens PLC and C# communication (Simatic Step7/PlcSim – VisualStudio)

1. New visual studio project

Create a new project :
1-new-project

2. S7.net Plus

S7.net Plus is a Siemens communication library.

2.1 Installation

Install it with the NuGet package manager :
2-NuGet

3-S7netplus

4-S7netplus

3. Program

We just create one label (label1) :
5-New-label

And we switch to the code :
6-Code

And the code :

Running :
7-Simulation

2 thoughts on “Siemens PLC and C# communication (Simatic Step7/PlcSim – VisualStudio)”

  1. hi, thank you for your excellent job. I would like to ask for a question about the data type when communicating PLCSIM and c# though the library. I would like to send a floating data like (1.15…) to Step 7 (MD: the data type is real ). I tried all the type in C# but none of them works. Could you give me some comment ? thank you very much!!

  2. Hi,

    I just tried to read an MD (real). I have a “WrongVarFormat” error, so I guess it’s not supported by the library.

    According to the code the types available for the “write” function are Byte, Int16, UInt16, Int32, UInt32, Double, Byte[], Int16[], UInt16[], Int32[], UInt32[], Double[], String.

    Code is here https://github.com/killnine/s7netplus/blob/master/S7.Net/PLC.cs .

    By the way, I strongly recommend to use a DB as an exchange buffer / interface between the PLC program and the IT application.

Leave a Reply

Your email address will not be published. Required fields are marked *