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

Programming an OPC DA .NET Client with C# and RCW for the SIMATIC NET OPC Server (COM/DCOM) and a simple OPC DA .NET Client with SIMATIC NET OPC Data Control
  Documentation for application 1 (3,0 MB)
  Documentation for application 2 (2,5 MB)
 Registrierung notwendig  Visual Studio 2010 project OPC DA Client (6,4 MB)
 Registrierung notwendig  Visual Studio 2010 project OPC DA Connector (7,9 MB)
 Registrierung notwendig  STEP 7 (TIA Portal) V15.1 project (732,4 KB)

OPC Client (RCW) V1.0
The version  1.0 of the example deals with the .NET programming in even more detail:
 Registrierung notwendig  OPC-Client (RCW) V1.0 (4,5 MB)

Last change
Update with STEP 7 (TIA Portal) V15.1

Security information
In order to protect technical infrastructures, systems, machines and networks against cyber threats, it is necessary to implement – and continuously maintain – a holistic, state-of-the-art IT security concept. Siemens’ products and solutions constitute one element of such a concept. For more information about cyber security, please visit
Rate entry
no rating
Requests and feedback
What do you want to do?
Note: The feedback always relates to the current entry / product. Your message will be forwarded to our technical editors working in the Online Support. In a few days, you will receive a response if your feedback requires one. If we have no further questions, you will not hear from us.