

To write the variables I use the method that permit to write a single object by giving an address and a value: To read values from the PLC I use the feature that read a class directly from a DB. If (plcDriver = null || plcDriver.ConnectionState != ConnectionStates.Online)ĬycleReadTime = DateTime.Now - lastReadTime Private void timer_Elapsed(object sender, e) You can of course use multiple timers, with different Interval value, to better manage the network resources. The timer callback is responsible to refresh the tags and to calculate the time passed after every read. Inside the class there is a multi-threaded timer that will poll the plc once every 100 ms (see constructor). Public void Write(string name, object value) The class exposes the properties and methods that are used in all application to communicate with the PLC: You can find the plc class inside PlcConnectivity folder. You can read more about it in this article: In the main project I usually define the class that contains the PLC values and communication thread in a singleton. Creation of PLC class inside the main project This is familiar if you already used OPC Servers and Clients, but here it is much more simple and basic. I use the concept of Tags inside my wrapper, where a Tag is an object containing an address and a value.
Void WriteItems(ListVoid ReadClass(object sourceClass, int db) Public byte ReadBytes(DataType dataType, int DB, int startByteAdr, int count) S7.Net exposes a class called Plc that contains all the methods that we can use to communicate with the plc:
S7 smart scroll removed driver#
Lack of a function that permit to read/write multiple non-connected variables with a single request to the plc.ĭocumentation on the driver and S7 protocol.What it’s not good about S7.Net, roadmap for future upgrades: ĝid I already say that it’s written in C#, no interop at all?.
S7 smart scroll removed license#
S7 smart scroll removed how to#
In this article I explain how to implement a Siemens S7 plc driver by using the open source driver S7.Net.
