/// <summary> /// Create a plc that will connect to localhost (Snap 7 server) and connect to it /// </summary> public S7NetTests() { plc = new Plc(CpuType.S7300, "127.0.0.1", 0, 2); //ConsoleManager.Show(); ShutDownServiceS7oiehsx64(); S7TestServer.Start(); plc.Open(); }
static void Main(string[] args) { S7.Net.Plc plc = new Plc(cpu: CpuType.S71200, ip: "10.1.10.142", rack: 0, slot: 1); ErrorCode errCode = plc.Open(); var b1 = (UInt16)plc.Read("MW100"); ErrorCode write = plc.Write("MW102", 100); plc.Close(); System.Console.WriteLine(b1); Console.ReadLine(); }