<< Click to Display Table of Contents >>

The settings window (Fig. 2) appears when creating a new connection or editing parameters of an existing one. Please note that all configured connections run simultaneously.

 

parameters-window

Fig. 2. Connection parameters.

 

COM port

 

Port - COM port number. You may select any port from the list. Note, however, that not all ports may exist in your operating system.

 

Parameters baud rate, data bits, parity, stop bits - these parameters are used to set data transfer rate, the number of data bits, bit parity mode, and the number of stop bits.

 

The Add button allows you to set your own customized data transfer rate. In the pop-up window, enter the rate value in bauds and click OK. That's how you add a new rate value to the list.

 

RS 485 interface mode - the option enables automatic control of the program by RTS signal. When transmitting data, the program will always keep this parameter enabled. This mode may be required when using external RS232-RS485 hardware converters.

 

Transmission control

 

parameters-window-2

Fig. 3: Hardware flow control settings

 

Hardware flow control over data transmission

 

The group of parameters "Hardware control of data transmission" and "Initial state" (Fig. 3) define the operating mode with the corresponding RS232 interface lines. If all options in the "Hardware data flow control" group are disabled, then data transfer control will not be performed. You can combine settings to configure different modes of data transmission control.

 

When Use RTS or Use DTR options are enabled, the program will set these signals when an internal reception buffer is almost filled to the maximum.

 

When Require CTS or Require DSR options are enabled, the program will suspend data transmission once the corresponding signal is received from an external device.

 

Please note that control over data transmission using RTS and CTS is more common than using DTR and DSR and works only for the interface RS232.

 

Software flow control

 

Control over data transmission is performed by transmitting specially allocated bytes with codes specified in the settings.

 

Control over data transmission is enabled by selecting either "Transmit," "Receive," or "Both" in the field "Type."

 

Xon - the command is issued when you need to start or resume data transmission.

 

Xoff - this command is used when you need to suspend data transmission temporarily.

 

During receipt of data, the program will issue Xon or Xoff commands when the internal buffer is filled up to 10% and 90%, respectively.

 

The program can receive these commands from an external device during transmission and start or pause data transmission.

 

In/out buffer size - allows you to set the size of the internal buffer of the program. Some COM port drivers may not support the default buffer size, and in this case, you need to set a smaller buffer size.

 

Network Settings

 

parameters-window-3

Fig. 4. IP Connection Setup.

 

Types of protocols

 

TCP is a proven and reliable protocol, probably the most widely used protocol in IP networks today. The advantage of the protocol is that it allows you to maintain and control connections between computers, and TCP also has internal means to control the integrity of transmitted data. However, the redundancy of transmitted data and the additional time required to establish a connection may be considered as a disadvantage of TCP. Most MODBUS TCP devices use TCP/IP protocol.

 

UDP is a connectionless protocol that does not require establishing a connection to transmit data. Similar to TCP, UDP works as the top layer of IP networks. However, unlike TCP, UDP does not facilitate data delivery and has no means of error control. But the protocol offers the possibility of direct sending and receiving data packets, allowing applications to monitor data integrity themselves and re-send data if necessary. For example, this feature is used in sending small-size broadcast packets. When using this protocol, the program works on the principle of "fire and forget".

 

Connection

 

Each MODBUS Gateway connection can work as:

 

1.Client. You need to specify the IP address and port of the remote computer on which the TCP/IP server is running and which you want to connect. The IP address you specify in MODBUS Gateway during configuration can also be a domain name (e.g., www.yourserver.com) or the computer's name on the local network. For example, if you want to connect to a computer with the "Plant1" name on a local network, you can type in "Plant1" in the IP address field instead of the IP address itself. This addressing type is useful when you configure MODBUS Gateway as a client, and IP addresses in your network are issued dynamically. In this case, it is more convenient to use a name instead of an IP address. The client mode is usually used when COM (MODBUS master) mode is selected in the "MODBUS" tab.

2.Server. In this mode, you must specify the IP address of the host computer with MODBUS Gateway. Suppose your computer has multiple network adapters or network interface cards. In that case, MODBUS Gateway will display a list of IP addresses for each network interface card (NIC) installed on your computer. Therefore, you should choose the IP address of the interface that you want to use. For MODBUS Gateway to work as a server, it is necessary to have at least one network card with an IP address assigned to it. In Microsoft Windows, TCP/IP protocol can be configured to obtain an IP address for a computer automatically. In this case, you need to contact the administrator and ask them to assign a static IP address to your computer and set this IP address to the selected network interface. Also, as an IP address, you can specify a special value of 0.0.0.0, which will mean that the program will listen to all IP addresses assigned to this computer. This mode is usually used when Network (MODBUS master) mode is selected in the "MODBUS" tab.

 

IP address and port - specify the address and port of the remote server (in client mode) or local IP address and port (in server mode).

 

Send timeout - allows you to set the time interval during which data will be "grouped" and sent as a single IP packet. It enables you to speed up data transfer if small portions of data are frequently received through the COM port.

 

Buffer data if TCP port is closed - when the option is enabled, the program puts all data received from the COM port into a temporary internal buffer, the size of which is set in the COM port tab. When the program restores a connection, it sends data from the buffer on a first-priority basis.

 

Server mode

 

This group of parameters (Fig. 5) is only applicable when a connection runs in server mode.

 

parameters-window-4

Fig. 5. Additional server parameters.

 

Max. clients - enables you to limit the number of clients simultaneously connected to the server. This option allows you to optimize the load on the server when multiple clients are connected, and zero value means that the number of connections is not limited.

 

Allowed IP addresses - This option is enabled in server mode and will enable you to define one or more addresses for which it is allowed to connect to the server. Connections from an IP address that is not listed will be rejected. This option is handy if you transmit data over an Internet connection or when the server is connected to a large corporate network. It is possible to specify multiple allowed addresses - one address in each line. If you leave the field empty, MODBUS Gateway will accept connections from all IP addresses.

 

Enable UPnP - this function enables UPnP mode, in which the program tries to detect a router on the network and send a command to redirect data for the configured server port to the local network address at which the program is running.

 

MODBUS Settings

 

This group of parameters (Fig. 6) allows you to select the mode of operation of a given connection and enable conversion of the addresses of MODBUS devices during protocol conversion.

 

parameters-window-5

Fig. 6. Additional MODBUS parameters.

 

Network (MODBUS Master) - in this case, the master device running under the MODBUS TCP protocol will access one or more MODBUS RTU slave devices connected via the COM port.

 

In this mode, several master devices can connect to one slave device. In this case, the program will arrange requests to the slave in one queue and execute them sequentially, sending responses to the appropriate requester. Please note that the response time may increase significantly due to such a queue, and the master may not receive a response in the expected time.

 

Request Timeout value allows you to skip requests that have not been answered in a reasonable time and move on to the next request. The value of this parameter has to be selected in accordance with the running speed of your slave device.

 

COM port (MODBUS master) - the master device operating under the MODBUS RTU protocol will access one or more MODBUS TCP slave devices connected over the network via a COM port.

 

In this mode, it is possible to configure conversion of the source address in the MODBUS RTU request to the IP address and the address of the target device, but in the MODBUS TCP format (Fig. 7). If the target IP address is not specified, then the IP address from the Network tab will be used.

 

parameters-window-6

Fig. 7. Address Conversion.

 

For each new IP address, the program creates a new connection within the configuration. The program's main window also contains the status of every additional connection.

 

Possibly that conversion will not be required in your system. Then the program will simply convert MODBUS RTU exchange protocol into MODBUS TCP.

 

Example

 

A MODBUS TCP slave device is connected over the network has address 5, and the program is configured to convert address 4 into 5.

 

1.The master device will send a request to the slave device with address 4.

2.MODBUS Gateway will change the protocol type to MODBUS TCP and the address to 5.

3.The program thus redirects the request to the network connection.

4.The program will wait for a response from the device with address 5.

5.If the correct response is received within the time specified as Request Timeout, the program will perform reverse conversion of MODBUS TCP to MODBUS RTU.

6.The program will change the address from 5 to 4 and calculate a new checksum of the response.

7.It will return a response to the master device.