Gets / Sets Type of PLC data type
Setting this property has no effect and is provided for compatibility with other INGEAR.NET software titles. The property will only return Boolean,Int16 (default), Int32, Single, String and Byte
VB Try ' ******************************** ' * initialize controller and tag Dim MyPLC as New ABLink.Controller("192.168.1.32", CPU.SLC, Driver.ENET) Dim MyTag as New ABLink.Tag("N7:0") ' ******************************* ' * Read tag MyPLC.ReadTag(MyTag) ' ******************************* ' * check the status If ResultCode.QUAL_GOOD = MyTag.QualityCode Then Console.WriteLine(MyTag.Timestamp.ToString()) Select Case MyTag.NetType Case GetType(System.Boolean) Console.WriteLine("Tag is Boolean") Case GetType(System.Int16) Console.WriteLine("Tag is Integer") Case GetType(System.Int32) Console.WriteLine("Tag is Long") Case GetType(System.Single) Console.WriteLine("Tag is Float") Case GetType(System.String) Console.WriteLine("Tag is String") Case GetType(System.Byte) Console.WriteLine("Tag is Byte") End Case Else Console.WriteLine(MyTag.ErrorString) End If Console.WriteLine(MyTag.QualityString) Catch ex As System.Exception Console.WriteLine(ex.Message) End Try C# try { ////////////////////////////////// // initialize controller and tag ABLink.Controller MyPLC = new ABLink.Controller("192.168.1.32", CPU.SLC, Driver.ENET); ABLink.Tag MyTag = new ABLink.Tag("N7:0"); ///////////////////////////////// // write value to PLC MyPLC.ReadTag(MyTag); ////////////////////////////////// // check results if(ResultCode.QUAL_GOOD == MyTag.QualityCode) Console.WriteLine(MyTag.Timestamp.ToString()); switch(MyTag.NetType) { case typeof(System.Boolean): Console.WriteLine("Tag is Boolean"); break; case typeof(System.Int16): Console.WriteLine("Tag is Integer"); break; case typeof(System.Int32): Console.WriteLine("Tag is Long"); break; case typeof(System.Single): Console.WriteLine("Tag is Float"); break; case typeof(System.String): Console.WriteLine("Tag is String"); break; case typeof(System.Byte): Console.WriteLine("Tag is Byte"); break; } else Console.WriteLine(MyTag.ErrorCode); Console.WriteLine(MyTag.QualityString); } catch(System.Exception ex) { Console.WriteLine(ex.Message); }
Tag Class | ABLink Namespace | DataType