ModSlaveSim help v3.04 - 3.5. Interface: Edit Interface to Master

Download manual: HTML

3.5. Interface: Edit Interface to Master

This is where you configure the interface to communicate with one or more Modbus masters. You can select the type of packet to be sent and the type of connection, which may be either serial or socket. Further properties of the selected interface, such as the port, or line speed, can also be edited here.

To navigate to these settings, type Ctrl-W to bring up the Edit Settings... dialog then with the Interface tab selected, click on the subpanel title under Edit Interface to Master.

.

3.5.1. Edit Interface

Packet Type. The default packet type is TCP (since Socket is the default interface). You would normally select RTU if you are using a serial interface, and TCP if you are using a socket interface. You may have to use ASCII for some legacy serial interfaces or devices. It is possible to use RTU or ASCII packets over a socket interface - this is non-standard, but can be useful for software testing. It is also possible to use TCP packets over a serial interface, but there is no good reason to do so (and there would be no error-checking of the packets).

Interface Type. The Socket interface is the default selection and the settings panel for the socket interface is displayed beneath it (i.e. the Host and Port fields). Selecting a different interface changes the panel beneath. Select Serial for a RS232/485 serial interface. If the selection of a new interface type is the only change, remember to press Apply.

  • Socket Interface settings

    As mentioned, when the Socket interface is selected the socket options host and port are displayed.

    Host. If you enter a host name or IP address of a network interface on the machine running ModSlaveSim, then ModSlaveSim will only accept connections via that network interface. For example, if you enter localhost (or 127.0.0.1) then ModSlaveSim will only accept connections from processes running on the same machine. If you leave this field empty, then ModSlaveSim will accept connections via any network interface.

    Port. Enter the port that ModSlaveSim should listen on for connections. The standard Modbus port number is 502, but this is a "privileged" port and you will not be able to listen on this port on a Unix/Linux machine unless you are "superuser". This is not normally advisable, so it's better for testing purposes to use a non-privileged port (above 1023).

  • Serial Interface settings

    The Serial interface panel is displayed when Serial is selected.

    Port. Name of the serial port that ModSlaveSim should use to talk to the master. Select from the list of ports found, or enter the port name if the desired port is not in the list. If (during testing) the connection between the master and slave is between two serial ports that are both on the same machine, then you must obviously use different port names for each. Don't forget to connect the two ports with a cable!

    Speed. Speed in bits/second.

    Parity. It's usual to use no parity, since the CRC in RTU packets is a good error check on its own, but some devices may require it.

    Data Bits. Must be 8 for RTU. Some ASCII devices may require 7 (the serial specification actually specifies 7 for ASCII).

    Stop Bits. Usually 1, but some legacy devices may require 2. The serial specification actually specifies 2 stop bits if parity is not being used, but this requirement is normally ignored.

    RTS Control. The default setting of High will be OK for most purposes. Selecting Flow Control will enable hardware flow control ("handshaking") using RTS and CTS. Since Modbus messages are short, flow control is not normally necessary. Selecting RS485 will use RTS to control a RS232 to RS485 converter: ModSlaveSim will raise RTS when it is transmitting data, and lower RTS to receive data. Note that the lowering of RTS may be delayed by the operating system, and this may cause loss of data. For this reason, we recommend the use of RS232-RS485 converters that do not require RTS control.

Press Apply to apply the changes.