首页 上一页 1 2 3 下一页 尾页

怎样用vb读取opc中的数据? 点击:11071 | 回复:50



支持共享

    
  • 精华:0帖
  • 求助:0帖
  • 帖子:7帖 | 13回
  • 年度积分:0
  • 历史总积分:34
  • 注册:2003年11月16日
发表于:2004-03-02 10:00:00
楼主
我刚刚接触opc,在fix7.0中,安装了它自带的opc服务,该怎样用vb编程读取opc中的数据啊? 先谢谢大家了.



frankw

  • 精华:0帖
  • 求助:0帖
  • 帖子:4帖 | 14回
  • 年度积分:0
  • 历史总积分:26
  • 注册:2003年3月19日
发表于:2003-11-18 15:27:00
1楼
我有OPC DATA ACTIVEX,它会使你的问题极为简单。

支持共享

  • 精华:0帖
  • 求助:0帖
  • 帖子:7帖 | 13回
  • 年度积分:0
  • 历史总积分:34
  • 注册:2003年11月16日
发表于:2003-11-18 16:48:00
2楼
能给我发一份吗,heart0818@163.com 多谢了!

sunsgd

  • 精华:0帖
  • 求助:0帖
  • 帖子:1帖 | 4回
  • 年度积分:0
  • 历史总积分:13
  • 注册:2002年10月28日
发表于:2003-11-18 21:43:00
3楼
给我一份好吗?sunsgd@tom.com不会是DEMO版的吧

小舟

  • 精华:0帖
  • 求助:0帖
  • 帖子:2帖 | 9回
  • 年度积分:0
  • 历史总积分:77
  • 注册:2003年5月29日
发表于:2003-11-19 09:38:00
4楼
能不能也给我一份,在这里先谢了,zypsmail@sina.com

疏影

  • 精华:0帖
  • 求助:0帖
  • 帖子:0帖 | 4回
  • 年度积分:0
  • 历史总积分:4
  • 注册:2003年10月10日
发表于:2003-11-19 11:15:00
5楼
能给我发一份吗?多谢!zhangxf@joeco.com.cn

deng_lp

  • 精华:5帖
  • 求助:0帖
  • 帖子:65帖 | 2669回
  • 年度积分:0
  • 历史总积分:2876
  • 注册:2001年6月19日
发表于:2003-11-19 12:22:00
6楼
用OPC Client程序可对fix中的OPC Server 数据进行读写.

jinking

  • 精华:0帖
  • 求助:0帖
  • 帖子:10帖 | 12回
  • 年度积分:0
  • 历史总积分:110
  • 注册:2001年6月24日
发表于:2003-11-19 12:43:00
7楼
请也给我一份,感激不尽!ogking@21cn.com

MaHengguii

  • 精华:0帖
  • 求助:0帖
  • 帖子:0帖 | 7回
  • 年度积分:0
  • 历史总积分:7
  • 注册:2002年9月05日
发表于:2003-11-20 12:20:00
8楼
能给我发一份吗?多谢!mymhg@126.com

pinto

  • 精华:0帖
  • 求助:0帖
  • 帖子:2帖 | 8回
  • 年度积分:0
  • 历史总积分:15
  • 注册:2002年4月23日
发表于:2003-11-21 10:34:00
9楼
提供一个类似的例子,VB编程应差不多, 不过抱歉1.)是英文的2.)是Rockwell RSLinx OPC -VB的例子 Within the VB Development enviroment add a reference to the RSLinx OPC automation DLL. For RsLinx Versions lower than 2.30 it is called RsLinxOPCAuto.DLL otherwise it is called RsiOPCAuto.DLL. This DLL exposes the RSLinx OPC Server automation interfaces to the client application . Within your program or class module declare the following objects : [Dim or Private] WithEvents oServer As OPCServer [Dim or Private] WithEvents oGroup As OPCGroup [Dim or Private] oItems As OPCItems ** The WithEvents keyword is used if you want to utilize the Event sink attributes of the OPCServer and OPCGroup Objects. The following code illustrates how to connect to the OPC server and create an OPC group: set oServer = new OPCServer oServer.Connect "RSLinx OPC Server" Set oGroup = oServer.OPCGroups.Add(mvaropcGroup) oGroup.OPCItems.DefaultAccessPath = mDAccessPath Set oItems = oGroup.OPCItems oGroup.IsActive = False oGroup.IsSubscribed = True oGroup.UpdateRate = 250 ** The Default access path is a string that contains the name of a valid DDE/OPC topic that has been created in RSLinx and points to appropriate controller (Softlogix or ControlLogix). This access path applies to all items within a specific group. To specify individual paths per item use the following syntax: [Path]Tag Name for each item. ** to see the Interfaces/objects exposed by the RSLinx OPC Automation DLL use the VB Object browser. Next you need to add OPC items to the created OPCGroup. These items represent PLC tags and should follow the Allen-Bradley naming conventions eg. PLC-5 N7:0 or N7:0,L10 (specifies an array of ten contigious elements). This is accomplished by utilizing the "oGroup.OpcItems.AddItems" function. It is important to dimension the associated input arrays with a base of 1. This is a requirement imposed in the OPC automation specification. otherwise you will get errors. When you have successfully added the appropriate items you need to set the "oGroup.IsActive" property to "True" such that RSLinx will start reading the desired Tags. To read/write specific Tags you can utilize the following functions: 1) oGroup.AsyncRead or oGroup.AsyncWrite (asynchronous access) 2) oGroup.SyncRead or oGroup.SyncWrite 3) oItem.Read or oItem.Write (Synchronous only) 4) If you only need the values when they change add code to the oGroup_DataChange event (the "oGroup.IsSubscribed" property must be set to True)

gongkongedit

  • 精华:1099帖
  • 求助:0帖
  • 帖子:14392帖 | 54470回
  • 年度积分:0
  • 历史总积分:622
  • 注册:2008年9月08日
发表于:2004-01-08 19:34:00
10楼
能不能也给我一份,在这里先谢了,denghuixin@126.com

情人节

  • 精华:0帖
  • 求助:0帖
  • 帖子:3帖 | 4回
  • 年度积分:0
  • 历史总积分:13
  • 注册:2004年2月15日
发表于:2004-02-15 12:04:00
11楼
能不能也给我一份,在这里先谢了,denghuixin@126.com

dcount

  • 精华:0帖
  • 求助:0帖
  • 帖子:2帖 | 14回
  • 年度积分:0
  • 历史总积分:78
  • 注册:2003年4月23日
发表于:2004-02-21 08:58:00
12楼
能不能也给我一份,在这里先谢了! dcount107@sina.com.cn

calm

  • 精华:0帖
  • 求助:0帖
  • 帖子:2帖 | 12回
  • 年度积分:0
  • 历史总积分:71
  • 注册:2004年2月22日
发表于:2004-02-23 19:05:00
13楼
能不能也给我一份,在这里先谢了 calm_lql.student@sina.com

乌雪纷飞

  • 精华:0帖
  • 求助:0帖
  • 帖子:2帖 | 13回
  • 年度积分:0
  • 历史总积分:18
  • 注册:2004年2月19日
发表于:2004-02-23 19:25:00
14楼
老兄也给我一份谢了. zhoujry2000◎sina,.com

kob

  • 精华:0帖
  • 求助:0帖
  • 帖子:0帖 | 1回
  • 年度积分:0
  • 历史总积分:4
  • 注册:2004年2月25日
发表于:2004-02-25 12:30:00
15楼
拜托你也给我一份,我正在做这方面的课题,谢了~~zjc412@sohu.com

EMAIN

  • 精华:0帖
  • 求助:0帖
  • 帖子:7帖 | 66回
  • 年度积分:0
  • 历史总积分:98
  • 注册:2003年10月31日
发表于:2004-02-28 21:46:00
16楼
FIX的PROGID是什么?还有ITEM的访问格式是什么啊?多谢。

Morris

  • 精华:1帖
  • 求助:0帖
  • 帖子:4帖 | 14回
  • 年度积分:0
  • 历史总积分:93
  • 注册:2001年5月05日
发表于:2004-03-01 14:18:00
17楼
FRANKW:能不能也给我一份,在这里先谢了!morris@fawcom.com.cn

天涯孤鹰

  • 精华:0帖
  • 求助:0帖
  • 帖子:5帖 | 17回
  • 年度积分:0
  • 历史总积分:194
  • 注册:2003年4月07日
发表于:2004-03-01 15:56:00
18楼
请教各位大侠:如何用VB、VC编程调用OPC

珑儿

  • 精华:0帖
  • 求助:0帖
  • 帖子:1帖 | 4回
  • 年度积分:0
  • 历史总积分:7
  • 注册:2004年3月02日
发表于:2004-03-02 10:00:00
19楼
发一份给我啊!谢谢。 ligaron@163.com

zhanghui700909

  • 精华:0帖
  • 求助:0帖
  • 帖子:0帖 | 7回
  • 年度积分:0
  • 历史总积分:11
  • 注册:2004年4月22日
发表于:2004-03-09 04:30:00
20楼
你好 你好!         我想来一份,谢谢,邮箱:suiger168@tom.com

热门招聘
相关主题

官方公众号

智造工程师
    首页 上一页 1 2 3 下一页 尾页