AdvancedHMI Software
General Category => Support Questions => Topic started by: qmd on April 26, 2016, 01:59:57 AM
-
Hi,
Just hoping to see a sample of how to use BeginReadMultiple()
Trying to work out how I can build my list of tags to read.
Thanks!
-
I managed to write the code for this to compile, but don't think it's correct as I am not ever getting a DataReceived event. Any idea why?
Code I used to read is:
Dim result As New Integer
Dim DintTags As New List(Of Drivers.CLXAddressRead)
DintTags.Add(New Drivers.CLXAddressRead("DINT1"))
DintTags.Add(New Drivers.CLXAddressRead("DINT2"))
DintTags.Add(New Drivers.CLXAddressRead("DINT3"))
DintTags.Add(New Drivers.CLXAddressRead("DINT4"))
DintTags.Add(New Drivers.CLXAddressRead("DINT5"))
result = EthernetIPforMicro800Com1.BeginReadMultiple(DintTags)
Console.WriteLine("result: " & result)
-
The BeginReadMultiple will fire the event, but the values are not extracted to e.Values
You will have to manually extract it like this:
Private Sub EthernetIPforCLXCom1_DataReceived_1(sender As Object, e As Drivers.Common.PlcComEventArgs) Handles EthernetIPforCLXCom1.DataReceived
Dim x As Int16 = BitConverter.ToInt32(e.RawData, 0)
MsgBox(x)
End Sub
-
My solution above is not correct. I'm investigating further into this
-
You will need to specify the NumberOfElements:
Dim addresses As New List(Of MfgControl.AdvancedHMI.Drivers.CLXAddressRead)
Dim adr As New MfgControl.AdvancedHMI.Drivers.CLXAddressRead("DINTTag")
adr.NumberOfElements = 1
addresses.Add(adr)
EthernetIPforCLXCom1.BeginReadMultiple(addresses)
-
Does this work on MicroLogix?
I have used your code:
Dim addresses As New List(Of MfgControl.AdvancedHMI.Drivers.CLXAddressRead)
Dim adr As New MfgControl.AdvancedHMI.Drivers.CLXAddressRead("DINT1")
adr.NumberOfElements = 1
addresses.Add(adr)
EthernetIPforMicro800Com1.BeginReadMultiple(addresses)
And get this exception: A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll
I can connect to tags with a subscription via the visual toolbox items though.
-
The Mirco800 series does not support Multi Service Requests.
-
OK thanks for your very prompt responses.