RMCLink.Interop .NET Assembly

RMCLink.CreateEthernetLink Method

Creates an RMCLink object for communicating with a controller (RMC70, RMC150, RMC200, or RMC100) over Ethernet.

Syntax

Visual Basic (Declaration)

Public Shared Function CreateEthernetLink ( _

   devType As DeviceType, _

   connectionString As String, _

) As RMCLink

 

Visual Basic (Usage)

Dim devType As DeviceType

Dim connectionString As String

Dim returnValue As RMCLink

 

returnValue = RMCLink.CreateEthernetLink(devType,connectionString)

 

C#

public static RMCLink CreateEthernetLink (

   DeviceType devType,

   string connectionString

)

 

Visual C++/CLI

public:

static RMCLink^ CreateEthernetLink (

   DeviceType devType,

   String^ connectionString

)

Parameters

devType

Specifies which type of RMC will be linked to. It must be DeviceType.RMC70, DeviceType.RMC150, DeviceType.RMC200, or DeviceType.RMC100.

connectionString

Specifies the TCP/IP host name for the controller to connect to. This can be an IP address string, such as "192.168.0.10" or a textual host name, such as "rmc.deltamotion.com". Additional options can also be specified as described under Advanced Communication Options.

Return Value

Returns a reference to a new RMCLink object created for communicating with the specified device type over TCP/IP using the specified host name.

Remarks

Notice that this method only creates the RMCLink object and does not connect to the controller. To connect to the device, you will need to call the Connect instance method. Because the object is only created and the connection is not made, this method returns immediately.

Advanced Communication Options

The connectionString parameter can optionally specify the following communication options if needed by the application.

Port Number (<hostName>:<portNum>)

This option specifies the TCP port number for RMCLink to use. The default port number is 44818 for the RMC75/150/200 and 1324 for the RMC100. This option should only be used to change the port number if there is a firewall or Network Address Translation (NAT) gateway that will translate to the correct port number (44818 or 1324) before RMCLink application traffic reaches the RMC controller.

To use a different port number, add ":<portNum>" immediately after the host name portion of the connectionString, where <portNum> is the port number to use.

Example:

Connection Size (connSize=<value>)

This option specifies the maximum EtherNet/IP messaging connection size to be used or may be used to select unconnected messaging. Larger connection sizes can greatly increase the data throughput for large transfers. This option is only supported when devType is DeviceType.RMC200.

To specify the connection size to use, add ";connSize=<value>" to the end of the connectionString parameter, where <value> is one of the following values:

Values greater than 17476 will be truncated. Values of 1-511 will be rejected. If not specified, the default value of 8716 is used.

Note that this parameter controls the maximum size that RMCLink may use, and the connection size may be further limited by the controller firmware. Specifically, RMC200 firmware prior to 1.19.0 will limit the connection size to 1416 bytes.

Examples:

Timeout (timeout=<value>)

This option specifies the Ethernet timeout for each transaction. To set the timeout, add “;timeout=<value>” to the end of the connectionString parameter, where <value> is the timeout in milliseconds. The range is 500 to 10000 (0.5 to 10 seconds). Out-of-range values will be clamped to the range. If not specified, the default of 2000 (2 seconds) is used.

Examples:

Exceptions

Exception Type

Condition

ArgumentNullException

The connectionString parameter refers to a null (Nothing in Visual Basic) object.

ArgumentOutOfRangeException

Either the devType parameter is not set to DeviceType.RMC70, DeviceType.RMC150, DeviceType.RMC200, or DeviceType.RMC200, or the connectionString parameter is blank.

Example

The following code example illustrates the use of the CreateEthernetLink method.

Visual Basic

Imports RMCLinkNET
 
Module Example
    Sub Main()
        ' Create the object itself.
        Dim rmc As RMCLink = RMCLink.CreateEthernetLink(DeviceType.RMC70, "192.168.0.10")
 
        ' Connect to the controller.
        rmc.Connect()
 
        ' Read and display Axis 0's Actual Position (F8:8).
        Dim data() As Single = New Single(0) {}
        rmc.ReadFFile(FileNumber70.fn70StatusAxis0,8,data,0,1)
        Console.WriteLine("Axis0 Actual Position = " & data(0) & " inches")
 
        ' Disconnect from the controller.
        rmc.Disconnect()
    End Sub
End Module

 

C#

using System;
using RMCLinkNET;
 
namespace Example
{
    public class Program
    {
        static void Main()
        {
            // Create the object itself.
            RMCLink rmc = RMCLink.CreateEthernetLink(DeviceType.RMC70, "192.168.0.10");
 
            // Connect to the controller.
            rmc.Connect();
 
            // Read and display Axis 0's Actual Position.
            float[] data = new float[1];
            rmc.ReadFFile(FileNumber70.fn70StatusAxis0,8,data,0,1);
            Console.WriteLine("Axis0 Actual Position = " + data[0] + " inches");
 
            // Disconnect from the controller.
            rmc.Disconnect();
        }
    }
}

 

Visual C++/CLI

using namespace System;
using namespace RMCLinkNET;
 
int main()
{
    // Create the object itself.
    RMCLink^ rmc = RMCLink::CreateEthernetLink(DeviceType::RMC70, "192.168.0.10");
 
    // Connect to the controller.
    rmc->Connect();
 
    // Read and display Axis 0's Actual Position.
    array<float>^ data = gcnew array<float>(1);
    rmc->ReadFFile(FileNumber70::fn70StatusAxis0,8,data,0,1);
    Console::WriteLine("Axis0 Actual Position = " + data[0] + " inches");
 
    // Disconnect from the controller.
    rmc->Disconnect();
 
    return 0;
}

See Also

RMCLink.Interop .NET Assembly | RMCLinkNET Namespace | RMCLink Class | DeviceType


Send comments on this topic.

Copyright (c) 2024 Delta Computer Systems, Inc. dba Delta Motion