如何使用C#使用opcdaauto.dll连接远程OPC服务器? [英] How to connect remote OPC Server using opcdaauto.dll using C#?

查看:903
本文介绍了如何使用C#使用opcdaauto.dll连接远程OPC服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用的DLL:来自OPC Foundation的opcdaauto.dll

DLL used : opcdaauto.dll from OPC Foundation

        OPCServer ObjOPCServer;
        OPCGroups ObjOPCGroups;
        OPCGroup ObjOPCGroup;

        ObjOPCServer = new OPCServer();
        string _serverName = "Kepware.KEPServerEX.V5";

        //In place of "", I need to give IP address of machine where OPC Server is present
        ObjOPCServer.Connect(_serverName, ""); 

然后我也无法交流。

预先感谢

推荐答案

            OPCServer ObjOPCServer = new OPCServer();
            OPCGroups ObjOPCGroups;
            OPCGroup ObjOPCGroup;
            //string _serverName = "Kepware.KEPServerEX.V5";
            string _serverName = "Matrikon.OPC.OMRON.1";

            ObjOPCServer.Connect(_serverName, "192.168.0.110");
            ObjOPCGroups = ObjOPCServer.OPCGroups;

            ObjOPCGroup = ObjOPCGroups.Add("Group1");
            ObjOPCGroup.DataChange += new DIOPCGroupEvent_DataChangeEventHandler(ObjOPCGroup_DataChange);
            ObjOPCGroup.OPCItems.AddItem("#MonitorACLFile", 1);

            //ObjOPCGroup.OPCItems.AddItem("Channel1.Device1.Tag2", 2);
            ObjOPCGroup.UpdateRate = 1000;
            ObjOPCGroup.IsActive = true;
            ObjOPCGroup.IsSubscribed = true;

引用: http://revanayya.blogspot.in/2013/12/opcclient-development-using-observer.html

这篇关于如何使用C#使用opcdaauto.dll连接远程OPC服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆