Performs cached Tag write operation.
The result of the operation. (see ResultCode)
If the instance of the Controller class is not already Connected, calling this method will automatically establish the connection.
| 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 ' ************************** ' * use Initialize ' * Dim MyPLC As New GELink.Controller("192.168.1.45") Dim MyTag As New GELink.Tag("%R1") MyTag.Value = 123 ' ************************** ' * Write Tag MyPLC.Write(MyTag) ' ************************* ' * check results If MyTag.QualityCode = ResultCode.QUAL_GOOD Then 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# using GELink; try { /////////////////////////// // Initialize GELink.Controller MyPLC = new GELink.Controller("192.168.1.45");
GELink.Tag MyTag = new GELInk.Tag("%R1"); /////////////////////////// // set the value MyTag.Value = 123; /////////////////////////// // write the tag MyPLC.WriteTag(MyTag); /////////////////////////// // check results if (ResultCode.QUAL_GOOD == MyTag.QualityCode) 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 | GroupWrite | Now | ReadTag