INGEAR.NET.ABLink

CTR Class

CTR Class (COUNTER) A class that represents the entire Allen-Bradley COUNTER structure from a type 'C' data table.

For a list of all members of this type, see CTR Members.

System.Object
   ABLink.CTR

[Visual Basic]
Public Class CTR
[C#]
public class CTR

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

To read/write a Counter element (e.g "C5:0.ACC") specific the element name in the Tag.Name (e.g Tag.Name = "C5:0.ACC") For a detailed description of the COUNTER structure please refer to the appropriate Allen-Bradley programmable logic controller instruction manual.

Example

VB
' ************************
' * initialize controller and tag
Dim MyPLC as New ABLink.Controller("192.168.1.32")
Dim MyTag as New ABLink.Tag("C5:0")

' ***********************
' * create a CTR class
Dim MyCTR As ABLink.CTR

Try
  ' ***********************
  ' * read the tag
  MyPLC.ReadTag(MyTag)

  If ResultCode.QUAL_GOOD = MyTag.QualityCode Then
    ' **********************
    ' * assign .Value to CTR class
    MyCTR = MyTag.Value
    Console.WriteLine(MyCTR.ACC.ToString())
    Console.WriteLine(MyCTR.PRE.ToString())
  End If
    
Catch ex As System.Exception
  Console.WriteLine(ex.Message)
End Try    

C#
///////////////////////////////////
// initialize controller and tag class
ABLink.Controller MyPLC = new Controller("192.168.1.32");
ABLink.Tag MyTag = new ABLink.Tag("C5:0");

try
{
   /////////////////////////////////
   // read the tag
   MyPLC.ReadTag(MyTag);
   
   if (ABLink.ResultCode.QUAL_GOOD == MyTag.QualityCode)
   {
     // assign .Value to CTR class
     ABLink.CTR MyCTR = (ABLink.CTR)MyTag.Value;
     Console.WriteLine(MyCTR.ACC.ToString());
     Console.WriteLine(MyCTR.PRE.ToString());
   }
}
catch(System.Exception ex)
{
   Console.WriteLine(ex.Message);
}        
     

Requirements

Namespace: ABLink

Assembly: INGEAR.NET.ABLink (in INGEAR.NET.ABLink.dll)

See Also

CTR Members | ABLink Namespace