D
<p>Does anyone have an example of doing a simple read of 2 or more integers from an Allen Bradley SLC or controllogix controller?
<p>I can read data using the addhandler(datachange) - but I can't seem to get an asyncread to work. Apparently I'm not getting my system.arrays for the serverhandles and errors configured correctly.
<p>I get a "Specified array was not of the expected type." on the asyncread.
<pre>
Imports RsiOPCAuto
Public Class Form1
Public WithEvents oServer As RsiOPCAutPCServer
Public WithEvents oGroup As RsiOPCAutPCGroup
Public oItem1 As RsiOPCAutPCItem
Public oItem2 As RsiOPCAutPCItem
Public oItem3 As RsiOPCAutPCItem
Public oItem4 As RsiOPCAutPCItem Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles
MyBase.Load
oServer = New RsiOPCAutPCServer
oServer.Connect("RSLinx OPC Server")
oGroup = oServer.OPCGroups.Add("TestGroup") oGroup.IsActive = True oGroup.UpdateRate = 500
oGroup.IsSubscribed = True oItem1 = oGroup.OPCItems.AddItem ("[Dale99]N7:0", 1)
Dim arHandles(9) As Object
Dim arerrors(9) As Object
Dim arTransID As Integer
Dim arCancelID As Integer
Dim i As Integer
i = 0
arHandles(i) = Group.OPCItems.ServerHandle
oGroup.AsyncRead(1, arHandles, arerrors, arTransID, arCancelID)
</pre>
<p>I can read data using the addhandler(datachange) - but I can't seem to get an asyncread to work. Apparently I'm not getting my system.arrays for the serverhandles and errors configured correctly.
<p>I get a "Specified array was not of the expected type." on the asyncread.
<pre>
Imports RsiOPCAuto
Public Class Form1
Public WithEvents oServer As RsiOPCAutPCServer
Public WithEvents oGroup As RsiOPCAutPCGroup
Public oItem1 As RsiOPCAutPCItem
Public oItem2 As RsiOPCAutPCItem
Public oItem3 As RsiOPCAutPCItem
Public oItem4 As RsiOPCAutPCItem Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles
MyBase.Load
oServer = New RsiOPCAutPCServer
oServer.Connect("RSLinx OPC Server")
oGroup = oServer.OPCGroups.Add("TestGroup") oGroup.IsActive = True oGroup.UpdateRate = 500
oGroup.IsSubscribed = True oItem1 = oGroup.OPCItems.AddItem ("[Dale99]N7:0", 1)
Dim arHandles(9) As Object
Dim arerrors(9) As Object
Dim arTransID As Integer
Dim arCancelID As Integer
Dim i As Integer
i = 0
arHandles(i) = Group.OPCItems.ServerHandle
oGroup.AsyncRead(1, arHandles, arerrors, arTransID, arCancelID)
</pre>