Siemens Industry Online Support
Siemens AG
Entry type: Application example, Entry ID: 21043779, Entry date: 09/04/2014

Programming of OPC DA .NET Clients with C# for the SIMATIC NET OPC Server (COM/DCOM)

  • Entry
  • Associated product(s)
Exchanging process data between programmable logic controllers and computers via OPC is a core element of automation technology. Due to the .NET technology introduced by Microsoft, the question arises how COM interfaces specified in OPC, such as C# can be used in .NET languages. The main requirement in this application is to show the C# programmer how process variables delivered via OPC can be visualized with a simple client.

The example at hand shows two options to create individual OPC clients under .NET with the programming language C#.

Application 1
The first application describes an universal OPC client that communicates with the SIMATIC NET OPC DA Server via RCW (Runtime Callable Wrapper). For the user of this application the complex RCW methods were encapsulated in a simplified, reusable and easily expandable API-DLL. This  DLL contains the most important methods to communicate with the SIMATIC NET OPC server.

User interface of application 1:

Figure 01

The following details are dealt with in this example:

  • Connection to the process data via Industrial Ethernet as well as the SIMATIC NET OPC Server V8.x.
  • Use of OPC DataAccess Custom interfaces RCW.
  • Symbolic and absolute addressing of process data.
  • Asynchronous/synchronous reading and writing of individual process data.
  • Writing and reading of large data volumes via block services.
  • Implemention of a structure for error handling.

Application 2
The second application shows how to handle the OPC DataControl for .NET. The Data Control was designed especially for the easiest access to the SIMATIC NET OPC Server. The user does not have to program anything in his development environment but can interconnect the OPC variables with his standard Windows controls. This method is suitable for very easy clients.

User interface of application 2:

Figure 02

Hardware configuration

Figure 03


Content of Downloads


Documentation Application 1 
Programming an OPC DA .NET Client with C# and RCW for the SIMATIC NET OPC Server (COM/DCOM)
21043779_OPCClient_RCW_DOKU_v2_1_e.pdf ( 2212 KB )
Code Application 1
Executable setup for installing the OPC client, STEP 7 V13 Project, Visual Studio .NET - project with all source files
21043779_Csharp_OPCClient_RCW_CODE.zip ( 2413 KB )
Documentation Application 2
Programming a simple OPC DA .NET Client with SIMATIC NET OPC Data Control
21043779_OPCDAConnector_DOKU_V1_1_e.pdf ( 1798 KB )
Code Application 2
Executable setup for installing the OPC client, STEP 7 V13 Project, Visual Studio .NET - project with all source files
21043779_OPCDAConnector_CODE.zip ( 8050 KB )

Your opinion is important to us
Please help us with your feedback to improve our entries. Archives

Content of Downloads


OPC Client (RCW) V1.0
The version  1.0 of the example deals with the .NET programming in even more detail.
21043779_Csharp_OPC_Client_v1_e.zip ( 4590 KB )

Security information
Siemens provides products and solutions with industrial security functions that support the secure operation of plants, solutions, machines, equipment and/or networks. They are important components in a holistic industrial security concept. With this in mind, Siemens’ products and solutions undergo continuous development. Siemens recommends strongly that you regularly check for product updates.
For the secure operation of Siemens products and solutions, it is necessary to take suitable preventive action (e.g. cell protection concept) and integrate each component into a holistic, state-of-the-art industrial security concept. Third-party products that may be in use should also be considered. For more information about industrial security, visit
To stay informed about product updates as they occur, sign up for a product-specific newsletter. For more information, visit

Last change
Migration to STEP 7 V13 and Visual Studio 2010