Indicates when a GroupRead or GroupWrite completes
VB Try ' **************************** ' * initialize controller, group and tags Dim MyPLC As New ABLink.Controller("192.168.1.32") Dim WithEvents MyGroup As New ABLink.TagGroup Dim Tag1 As New ABLink.Tag("N7:0") Dim Tag2 As New GELink.Tag("F8:0") ' ***************************** ' * add the event handler AddHandler MyGroup.Update, AddressOf MyGroup_Update ' ***************************** ' * add tags to group MyGroup.AddTag(Tag1) MyGroup.AddTag(Tag2) ' ***************************** ' * Read the Group MyPLC.GroupRead(MyGroup) Catch ex As System.Exception Console.WriteLine(ex.Message) End Try ' ************************** ' * Event Handler ' ************************** Private Sub MyGroup_Update(ByVal sender As Object, ByVal e As ABLink.TagGroupEventArgs) Handles MyGroup.Update) Try ' * what caused event Console.WriteLine(e.EventName) ' * process list of tags For Each (ABLink.Tag theTag in e.TagList) Console.WriteLine(theTag.Value.ToString()) Next Catch ex As System.Exception Console.WriteLine(ex.Message) End Try End Sub
C# try { /////////////////////////////////////// // initialize controller, group and tags ABLink.Controller MyPLC = new ABLink.Controller("192.168.1.45") ABLink.TagGroup MyGroup = new ABLink.TagGroup(); ABLink.Tag Tag1 = new ABLink.Tag("N7:0"); ABLink.Tag Tag2 = new ABLink.Tag("F8:0"); // add the event handler MyGroup.GroupUpdate += new MyTag.GroupUpdateEventHandler(MyGroup_Update); // read the tag MyPLC.ReadTag(myTag); } catch(System.Exception ex) { Console.WriteLine(ex.Message); } ///////////////////////////// // event handler void MyGroup_Update(sender As Object, e As ABLink.DataChangeEventArgs) Handles Tag1.Changed) { try { if( e.QualityCode == ResultCode.QUAL_GOOD) Console.WriteLine(e.Value.ToString()); }
Namespace: ABLink
Assembly: INGEAR.NET.ABLink (in INGEAR.NET.ABLink.dll)