By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,986 Members | 1,905 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,986 IT Pros & Developers. It's quick & easy.

How can I read data from an OPC group on an OPC server?

P: 4
Im using this function
---------------------------------------------------------

Public Function Request_Word(ByRef MyOPCServer As OPCAutomation.OPCServer, ByRef MyOPCGroup As String, ByRef ServerHandles() As Integer, ByRef NumberItems As Integer) As OPCItem

Dim vValue() As Integer
Dim lErrors() As Integer
Dim vQuality As Object
Dim vTimeStamp As Object

Call MyOPCServer.Connect(OPCServerType, OPCServerName)

MyOPCServer.OPCGroups.Item(MyOPCGroup).SyncRead(OP CAutomation.OPCDataSource.OPCCache, NumberItems, ServerHandles, vValue, lErrors, vQuality, vTimeStamp)'DEBUG CODE LINE

With Request_Word
.Name = MyOPCServer.OPCGroups.Item(MyOPCGroup).OPCItems.It em(1).ItemID
.Value = vValue(1)
.Quality = vQuality(1)
.TimeStamp = vTimeStamp(1)
End With
End Function
--------------------------------------------------------

But Im having a debug on the bold code line, "ArgumentException was unhandle", "Values does not fall within the expected range"
Dec 17 '16 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.