RMCLink COM Component

RMCLinkServer.CreateEthernetLink Method

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

Syntax

Visual Basic (Declaration)

Function CreateEthernetLink ( _

   devType As DeviceType, _

   connectionString As String _

) As RMCLink

 

Visual Basic (Usage)

Dim instance As RMCLinkServer

Dim devType As DeviceType

Dim connectionString As String

Dim returnValue As RMCLink

 

returnValue = instance.CreateEthernetLink(devType, connectionString)

Parameters

devType

Specifies which type of RMC will be linked to. It must be dtRMC70, dtRMC150, dtRMC200, or dtRMC100.

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 RMCLink.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 dtRMC200.

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

Error Code

Description

rmcEOutOfMemory = 5

Out of memory.

rmcEInvalidArg = 7

Invalid argument. Ensure that devType was dtRMC70, dtRMC150, dtRMC200 or dtRMC100 and that connectionString had a host name.

Example

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

Visual Basic 6 / VBA

Option Explicit
 
Public Sub Sample()
    ' Declare and create the RMCLinkServer COM object.
    Dim srv As New RMCLinkServer
 
    ' Use our RMCLinkServer to create the correct type of RMCLink object.
    Dim rmc As RMCLink
    Set rmc = srv.CreateEthernetLink(dtRMC70, "192.168.0.22")
 
    ' Establish the connection.
    rmc.Connect
 
    ' Read F8:8 and F8:9 (Axis 0 Actual Position and Velocity)
    Dim data As Variant
    data = rmc.ReadFFile(fn70StatusAxis0, 8, 2)
    resultText = "Actual Position = " & data(0) & ", Actual Velocity = " & data(1)
 
    ' Close the connection.
    rmc.Disconnect
End Sub

 

VBScript

Option Explicit
Dim srv, rmc, data
 
' First we need to create the RMCLinkServer COM object.
Set srv = CreateObject("RMCLink.RMCLinkServer")
 
' Use our RMCLinkServer to create the correct type of RMCLink object.
' NOTE: VBScript does not support enumerations, so we use the literal value (dtRMC70=2).
Set rmc = srv.CreateEthernetLink(2, "192.168.0.22")
 
' Establish the connection.
rmc.Connect
 
' Read F8:8 and F8:9 (Axis 0 Actual Position and Velocity)
data = rmc.ReadFFile_Script(8,8,2)
WScript.Echo "Actual Position = " & data(0) & ", Actual Velocity = " & data(1)
 
' Close the connection.
rmc.Disconnect 

 

JScript

// First we need to create the RMCLinkServer COM object.
var srv = new ActiveXObject("RMCLink.RMCLinkServer");
 
// Use our RMCLinkServer to create the correct type of RMCLink object.
// NOTE: JScript does not support enumerations, so we use the literal value (dtRMC70=2).
 
var rmc = srv.CreateEthernetLink(2, "192.168.0.22");
// Establish the connection.
rmc.Connect();
 
// Read F8:8 and F8:9 (Axis 0 Actual Position and Velocity)
var data = rmc.ReadFFile_Script(8,8,2).toArray();
WScript.echo("Actual Position = " + data[0] + ", Actual Velocity = " + data[1]);
 
// Close the connection.
rmc.Disconnect();

See Also

RMCLinkServer Class | RMCLink Class | RMCLink COM Component


Send comments on this topic.

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