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

1. New visual studio project

Create a new project :

2. Plus Plus is a Siemens communication library.

2.1 Installation

Install it with the NuGet package manager :



3. Program

We just create one label (label1) :

And we switch to the code :

And the code :

Running :

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 .

    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 to Luman Zhao Cancel reply

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