INGEAR.NET.ABLink

 

Tag.DataType Property

Returns one of the enumerated Tag.ATOMIC types.

[Visual Basic]
Public ReadOnly Property DataType As ATOMIC
[C#]
public Tag.ATOMIC DataType {get;}

 

Example

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.DataType        Case ATOMIC.BOOLEAN)          Console.WriteLine("Tag is Boolean")        Case ATOMIC.INTEGER          Console.WriteLine("Tag is Integer")        Case ATOMIC.LONG          Console.WriteLine("Tag is Long")        Case ATOMIC.FLOAT          Console.WriteLine("Tag is Float")        Case ATOMIC.STRING          Console.WriteLine("Tag is String")        Case ATOMIC.ASCII          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.DataType)    {        case ATOMIC.BOOLEAN:          Console.WriteLine("Tag is Boolean");          break;        case ATOMIC.INTEGER:          Console.WriteLine("Tag is Integer");          break;        case ATOMIC.LONG:          Console.WriteLine("Tag is Long");          break;        case ATOMIC.FLOAT:              Console.WriteLine("Tag is Float");          break;        case ATOMIC.STRING:          Console.WriteLine("Tag is String");          break;        case ATOMIC.ASCII:          Console.WriteLine("Tag is Byte");          break;     }           else    Console.WriteLine(MyTag.ErrorCode);  Console.WriteLine(MyTag.QualityString);     } catch(System.Exception ex) {  Console.WriteLine(ex.Message); }  

See Also

Tag Class | ABLink Namespace | NetType