‘给客户端句柄赋值
Next
MyOPCGroup.OPCItems.AddItems ItemCount, abItemIDs, abClientHandles, abServerHandles, abErrors
‘添加数据项操作
(4) 同步数据读写
OPC数据存取有同步方式和异步方式两种。异步读写数据复杂,需要与事件结合使用,与同步相比速度慢但准确性高。同步读写数据简单,直接使用OPCItem的方法即可。
Dim One As OPCItem
Dim Index As Long
‘Index为标签顺序号
Dim OneRead As String
Dim Xie As String
Set One = MyOPCGroup.OPCItems(Index)
One.Read OPCCache
OneRead = One.
‘读数据
MyOPCGroup.SyncWrite ItemCount, ServerHandles, ss, Errors
‘同步写数据
MyOPCGroup.SyncRead OPCCache, ItemCount, ServerHandles, Read, Errors
‘同步读数据
One.Write (Xie)
‘写数据
上一页 [1] [2] [3] [4] 下一页
本文关键字:暂无联系方式PLC入门,plc技术 - PLC入门