INGEAR.NET.ABLink

 

Controller.Connect Method 

Connects the instances of the Controller class to the Allen-Bradley device

[Visual Basic]
NotOverridable Public Function Connect() As Integer _
    Implements IController.Connect
[C#]
public int Connect();

Return Value

ResultCode.SUCCESS if successful, else error. ResultCode for list of possible failures

Implements

IController.Connect

Remarks

Your application does not need to explicitly call Connect. Calling ReadTag, WriteTag, GroupRead or GroupWrite will automatically establish a connection if the Controller class is not already connected.  

Example

VB
' ********************************
' * initialize controller class
Dim MyPLC as New ABLink.Controller()
' ********************************
' * set the IP Address
MyPLC.IPAddress = "192.168.1.33"
' ********************************
' * set the CPU Type
MyPLC.CPUType = CPU.PLC
' ********************************
' * set the Driver Type
MyPLC.DriverType = Driver.ENET
' ********************************
' * connect to the PLC
MyPLC.Connect()
' ********************************
' * report connection status
Console.WriteLine(MyPLC.ErrorString)


C# ////////////////////////////////// // initialize controller ABLink.Controller MyPLC = new ABLink.Controller() ////////////////////////////////// // set the IP address MyPLC.IPAddress = "192.168.1.33"; ////////////////////////////////// // set the cpu type MyPLC.CPUType = CPU.PLC; ////////////////////////////////// // set the driver type MyPLC.DriverType = Driver.ENET; ////////////////////////////////// // connect to the PLC MyPLC.Connect(); ////////////////////////////////// // report connection status Console.WriteLine (MyPLC.ErrorString);

See Also

Controller Class | ABLink Namespace | IPAddress | CPUType | DriverType | Path | IsConnected