Wednesday, 30 March 2016

My Simple OPC Client

As request from our friends, here we create a simple VB application/project to communicate with OPC Server.

Previously, we create My OPC Client project, the latest is version 5, with some advanced feature. But some friends need more simple application, so we create this project. The purpose of the application is to connect to OPC Server, Read data and Write data. So here is MySimpleOPCClient..




For testing, we use Matrikon OPC Explorer, you can download from here.
Please download MySimpleOPCClient project source code from here.


The steps:
1. Run Matrikon OPC Explorer
2. Create group, and add some items to monitor, ie "Bucket Brigade.Int1"
4. Run MySimpleOPCClient
5. Write "Matrikon.OPC.Simulation.1" on OPC Server Name textbox
6. Click Connect button
7. On OPC Item textbox, write "Bucket Brigade.Int1"
8. Click on Add Item button
9. The value of item is automatically loaded to the Read Value textbox
10. Try to write new value on Write Value textbox, then click on Write button




Note: 
Before opening the project, please make sure you have OPCDAAuto.dll installed/registered on your system. Please follow these steps to register the DLL:
> download DLL from here
> copy file to /System32 folder
> open CMD (command prompt)
> write this command: "regsvr32 OPCDAAuto.dll"

We create this project with MS Visual Studio Express 2010, and we targeted to .NET Framework 4. If you get some problem, please let us know.

See you next time.. Thank you...

14 komentar:

  1. Wow! Thanks a lot!
    So simple and functionally ;)

    ReplyDelete
  2. hello,can you help me Mister hadi hidayat,i went to send data from c# to labview so i will use ni opc server from national instrument and in c# i need to build opc client how can communicacat with ni opc server,please i need a help

    ReplyDelete
  3. i need a code of opc client in c# witch i can send data to ni opc server im sorry im not native speaker

    ReplyDelete
    Replies
    1. Hi,
      you can convert the source code here from VB to C using this tool:
      http://www.developerfusion.com/tools/convert/vb-to-csharp/

      Thanks.

      Delete
  4. Hi

    I can't install the OPCDAAuto.dll
    I'm always getting "The specified module can not be found"
    I must say that I'm using a 64-bit WIN7 operating system
    Can you help me out?

    ReplyDelete
    Replies
    1. Hi..

      try:
      > copy OPCDAAuto.dll to folder C:\windows\syswow64
      > open Command Prompt with "Run as Administrator"
      > type: "cd \windows\syswow64"
      > type: "regsvr32 OPCDAAuto.dll"

      Thanks.

      Delete
    2. Thanks! Now going to try to communicate with Simatic NET OPC Server.

      Delete
  5. Hello Hadi,
    Your blogs are wonderful and very much supportive for me.
    I need documentation of the dlls (OPCDAAuto.dll and Interop.OPCAutomation.dll) you used in the project.
    Thanks.
    Regards,
    Fahad

    ReplyDelete
    Replies
    1. Hello,
      Thanks for your appreciation.
      Please visit OPC Foundation website here:
      https://opcfoundation.org/developer-tools/developer-kits-classic/core-components

      or you can ask to OPC Foundation support by email.

      Delete
  6. Hi Hadi, thank you for the codes, they are very useful and precious.

    ReplyDelete
    Replies
    1. Hi Mateus... You are welcome.

      Delete
    2. Thanks, I'm a benginner in VB.net, do you know if is possible to convert your code to a console aplication?

      I'm trying but if this not possible I will stop to try it.

      Delete
    3. Hi..
      Sorry, I dont know about that. But I think, it's better for you to try.. so you will know the answer..
      Good luck!

      Delete

 
Copyright © . HadiSCADA - Posts · Comments
Theme Template by BTDesigner · Powered by Blogger