Read Data Block of S7 300 PLC using C#

            S7Client client = new S7Client();
            int result = client.ConnectTo("192.168.0.3", 0, 2);

            if (result != 0)
            {
                Console.WriteLine(client.ErrorText(result));
            }
            else
            {
                byte[] dbBuffer = new byte[12];
                result = client.DBRead(1, 0, 12, dbBuffer);
                var var1 = S7.GetIntAt(dbBuffer, 0);
                var var2 = S7.GetRealAt(dbBuffer, 2);
                var var4 = S7.GetDWordAt(dbBuffer, 8);
                Console.WriteLine(var1);
                Console.WriteLine(var2);
                Console.WriteLine(var4);
            }

 

References
https://github.com/fbarresi/Sharp7/wiki
https://github.com/S7NetPlus/s7netplus/wiki
http://gmiru.com/article/s7comm/
https://wiki.wireshark.org/S7comm
https://plc4x.incubator.apache.org/protocols/s7/index.html

Connect Step 7 PLC-Sim to Scadas using NetToPLCsim

You should use Nettoplcsim in this way

  • restart computer
  • before starting any Siemens software, start Nettoplcsim with Admin rights, and let Nettoplcsim stop/start the Siemens service to capture the TCP port 102. Let Nettoplcsim in this state (open with no configuration)
  • start Step 7 (or TIA Portal if you want to use this), then start Plcsim and download your project
  • configure Plcsim station in Nettoplcsim, and start Nettoplcsim server

References
https://www.mesta-automation.com/nettoplcsim-how-to-connect-step-7-plc-sim-to-scadas/
http://nettoplcsim.sourceforge.net/
https://sourceforge.net/p/nettoplcsim/discussion/912717/thread/777cf7c4/?limit=25