标题:请教VB通过OPC连接WinCC的问题
只看楼主
shangcq
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2013-8-17
 问题点数:0 回复次数:0 
请教VB通过OPC连接WinCC的问题
下面这段代码显示能连接上,但是plcVal()数组中的值是空值,请高手帮忙指导一下,谢谢。

Option Explicit

Option Base 1

Const ServerName = "OPCServer.WinCC"

Const NodeName = "QQXWIMEKRUOT2ZT"

Private objServer As OPCServer   '定义OPC服务器

Private objGroup As OPCGroup   '定义OPC 服务器中的组

Private objGroups As OPCGroups

Private objItems As OPCItems  '定义OPC 服务器中的项目名

 

Dim StrItemIDs(10) As String

Dim ClientHandles(6) As Long

Dim Serverhandles() As Long

Dim i As Integer

Dim DataType(1000) As Integer

Dim errors() As Long

Dim accpath(1000) As String

Private Sub Command1_Click()
Dim plcVal() As Variant
Dim OPCCache As Integer

objGroup.SyncRead OPCCache, 3, Serverhandles, plcVal, errors


Text1.Text = plcVal(1)

Text2.Text = plcVal(2)

Text3.Text = plcVal(3)

End Sub
搜索更多相关主题的帖子: 服务器 项目 
2013-08-17 10:28



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-419249-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.917918 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved