RMCLink COM Component

RMCLinkServer Class

Use an instance of this class to create an RMCLink object that will be used to communicate with an RMC.

An RMCLinkServer object must be created using language-specific methods, as shown in the Example section below. Using this object, an RMCLink object is created by the CreateEthernetLink, CreateSerialLink or CreateUSBLink method.

Methods

CreateEthernetLink

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

CreateSerialLink

Creates an RMCLink object for communicating with a controller (RMC70 or RMC100) over a serial port.

CreateUSBLink

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

Remarks

An RMCLinkServer object is used to create an RMCLink object with either the CreateEthernetLink, CreateSerialLink, or CreateUSBLink method, which specify the type and address (serial port or host name) of the controller you want to connect to. After the RMCLink object has been created, the RMCLinkServer object is not used and can be released. The RMCLink object is then used to open communications, perform communications, and close communications.

Example

The following code example illustrates the basic use of the RMCLinkServer class:

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

RMCLink COM Component | RMCLink Class


Send comments on this topic.

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