Performs cached Tag read operation.
The status of the operation (see ResultCode)
If the instance of the Controller class is not already connected to the programmable logic controller, calling this method will automatically establish a connection.
The data value from the programmable logic controller will be returned in the Value property of the Tag class.
| Exception Type | Condition |
|---|---|
| ArgumentNullException | Thrown if Tag parameter is a null reference (Nothing in Visual Basic) |
| InvalidOperationException | Thrown if Tag parameter is not Tag Type, or if Name> is null or empty, or Value is null |
VB Try ' ************************** ' * Initialize ' * Dim MyPLC As New GELink.Controller("192.168.1.45") Dim MyTag As New GELink.Tag("%R1") ' ************************** ' * read Tag MyPLC.ReadTag(MyTag) ' ************************* ' * check results If MyTag.QualityCode = ResultCode.QUAL_GOOD Then Console.WriteLine(Convert.ToString(MyTag.Value)) Console.WriteLine(MyTag.TimeStamp.ToString()) End If ' ************************* ' * show quality status and error Console.WriteLine(MyTag.QualityString) Console.WriteLine(MyTag.ErrorString) Catch ex As Exception Console.WriteLine(ex.Message, Me.Text) End Try C# try { /////////////////////////// // initialize
GELink.Controller MyPLC = new GELink.Controller("192.168.1.45");
GELink.Tag MyTag = MyPLC.CreateNewTag(); /////////////////////////// // read the tag MyPLC.ReadTag(MyTag); /////////////////////////// // check results if (ResultCode.QUAL_GOOD == MyTag.QualityCode) { Console.WriteLine(Convert.ToString(MyTag.Value)); Console.WriteLine(MyTag.TimeStamp.ToString()); } /////////////////////////// // show quality and error Console.WriteLine(MyTag.QualityString); Console.WriteLine(MyTag.ErrorString); } catch (System.Exception ex) { Console.WriteLine(ex.Message, this.Text); }
Controller Class | GELink Namespace | GroupRead | WriteTag | Now