There are two main ways to communicate to the RMC over Ethernet from a custom application:
The RMCLink ActiveX Control and .Net Assembly Component can be used if the application is running on Windows. See RMCLink topic for details.
A TCP/IP API such as BSD Sockets or Winsock can be used to directly write over TCP/IP. This method is not limited to Windows or even PCs. This method is discussed in this topic.
Choosing a TCP/IP Stack and API
The PC or device to be programmed must have a TCP/IP Stack and Application Programming Interface (API). All Windows platforms (since Windows 95) include support for a TCP/IP stack and include the Winsock API. Unix platforms typically also have a TCP/IP stack and the BSD Sockets API. It may be more challenging to find a TCP/IP stack and accompanying API for embedded devices, but we expect that such users will understand the depth of their undertaking.
Choosing an Application Protocol
Unless you already have one of the RMC's application protocols implemented, we recommend the Modicon Modbus/TCP protocol. This protocol is one of the simplest protocols and has an open standard. This means the protocol specification is publicly available. See the Modicon Modbus/TCP web site at http://www.modbus.org for complete details on the protocol including C examples for both Windows and Unix and a Java example.
Modbus/TCP Implementation Notes
While the Modicon Modbus/TCP web site has documentation and sample code for its Modbus/TCP protocol, it is worth pointing out a few specifics on communicating with the RMC over Modbus/TCP. This section neither replaces nor modifies the Modbus/TCP specification, but clarifies key points and defines the RMC's function support.
To create a connection with the RMC over Modbus/TCP, open a client socket with the RMC on TCP port 502. The RMC will only respond to Modbus/TCP requests on this port. Other ports are reserved or used by other protocols.
The Unit Identifier (Slave Address) field in the Modbus/TCP is only used by routing devices. Since the Slave Address is not used by the RMC, it should be set to zero (0) in requests to the RMC.
The RMC supports the following function codes:
Read Multiple Registers (FC 3)
Write Multiple Registers (FC 16)
Read Input Registers (FC 4)
Write Single Register (FC 6)
Read/Write Registers (FC 23)
Get Diagnostics (FC 8)
Typically, only functions 3 and 16 are used. Function 23 can be used to improve performance by doing a read and write in a single function. FC 4, 6, and 8 were included for compatibility with existing Modbus/TCP masters, but otherwise add no value to the RMC.
Most of the above functions have a Reference Number field. This value is a register address, which must be converted to an RMC register address. Subtract one from the Reference Number to get the RMC's Modbus/TCP register address documented in RMC Register Map (Modbus/TCP and Modbus/RTU). The addresses documented in RMC Register Map (PROFIBUS-DP Message Mode) happen to already have one subtracted, so you may prefer to use that register map even though it describes PROFIBUS-DP.
The RMC handles incoming packets on a first-in first-out (FIFO) basis, making it possible to send multiple requests and then wait for the replies. However, the RMC cannot hold a large number of requests at a time, so it is advised that only one or two requests be sent before waiting for the replies.
The RMC can handle up to four open TCP/IP connections at once. Typically each device uses one connection at a time, allowing the RMC to typically be connected to four devices at once.
Multiple-register reads and writes are limited to 100 words for writes and 125 words for reads—per the Modbus/TCP specification—even though the length field in the Modbus/TCP header makes it look like larger packets would be supported.
Copyright (c) 1997-2015 by Delta Computer Systems, Inc.